From 44f2fefb65c55a0fbe70ffb428953bdc80d63b41 Mon Sep 17 00:00:00 2001 From: Yelaman Date: Sun, 30 Jun 2024 21:55:15 +0500 Subject: [PATCH] - t f fix issue with range on windows during get directory path --- .../lib/src/core/utils/file_path_extractor.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/approval_tests/lib/src/core/utils/file_path_extractor.dart b/packages/approval_tests/lib/src/core/utils/file_path_extractor.dart index a2bd745..a6d7961 100644 --- a/packages/approval_tests/lib/src/core/utils/file_path_extractor.dart +++ b/packages/approval_tests/lib/src/core/utils/file_path_extractor.dart @@ -67,7 +67,9 @@ class FilePathExtractor { filePath = Uri.tryParse('file:///${match.group(1)!}')!.toFilePath(); } - final directoryPath = filePath.substring(0, filePath.lastIndexOf('/')); + final separator = isWindows ? '\\' : '/'; + final directoryPath = + filePath.substring(0, filePath.lastIndexOf(separator)); return directoryPath; } else { throw FileNotFoundException(