From c016be7960b81f299a0e699a506598f12c399951 Mon Sep 17 00:00:00 2001 From: Yelaman Yelmuratov Date: Sun, 19 May 2024 03:38:02 +0500 Subject: [PATCH] . B fix path extractor for linux/mac --- lib/src/core/file_path_extractor.dart | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/src/core/file_path_extractor.dart b/lib/src/core/file_path_extractor.dart index e9eb949..9a94710 100644 --- a/lib/src/core/file_path_extractor.dart +++ b/lib/src/core/file_path_extractor.dart @@ -15,9 +15,14 @@ class FilePathExtractor { final match = uriRegExp.firstMatch(stackTraceString); if (match != null) { - final rawPath = match.group(1)!; - final filePath = isWindows ? Uri.file(rawPath, windows: true).toFilePath(windows: true) : Uri.file(rawPath).toFilePath(); - return filePath; + if (isWindows) { + final rawPath = match.group(1)!; + final filePath = Uri.file(rawPath, windows: true).toFilePath(windows: true); + return filePath; + } else { + final filePath = Uri.tryParse('file:///${match.group(1)!}'); + return filePath!.toFilePath(); + } } else { throw FileNotFoundException( message: 'File not found in stack trace', @@ -32,5 +37,5 @@ class FilePathExtractor { static bool isWindows = Platform.isWindows; static const String _windowsPattern = r'file:///([a-zA-Z]:/[^:\s]+)'; - static const String _linuxMacOSPattern = r'file:///([^:\s]+)'; + static const String _linuxMacOSPattern = r'file:\/\/\/([^\s:]+)'; }