Skip to content

Commit c016be7

Browse files
committed
. B fix path extractor for linux/mac
1 parent 4f7346c commit c016be7

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lib/src/core/file_path_extractor.dart

+9-4
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,14 @@ class FilePathExtractor {
1515
final match = uriRegExp.firstMatch(stackTraceString);
1616

1717
if (match != null) {
18-
final rawPath = match.group(1)!;
19-
final filePath = isWindows ? Uri.file(rawPath, windows: true).toFilePath(windows: true) : Uri.file(rawPath).toFilePath();
20-
return filePath;
18+
if (isWindows) {
19+
final rawPath = match.group(1)!;
20+
final filePath = Uri.file(rawPath, windows: true).toFilePath(windows: true);
21+
return filePath;
22+
} else {
23+
final filePath = Uri.tryParse('file:///${match.group(1)!}');
24+
return filePath!.toFilePath();
25+
}
2126
} else {
2227
throw FileNotFoundException(
2328
message: 'File not found in stack trace',
@@ -32,5 +37,5 @@ class FilePathExtractor {
3237
static bool isWindows = Platform.isWindows;
3338

3439
static const String _windowsPattern = r'file:///([a-zA-Z]:/[^:\s]+)';
35-
static const String _linuxMacOSPattern = r'file:///([^:\s]+)';
40+
static const String _linuxMacOSPattern = r'file:\/\/\/([^\s:]+)';
3641
}

0 commit comments

Comments
 (0)