-
-
Notifications
You must be signed in to change notification settings - Fork 14
commit 15736c9
abduznik edited this page May 23, 2026
·
1 revision
Commit: 15736c9fbe6a1610ebcc22ff9d58f4e9cf57d685
Author: abduznik
Date: 2026-04-28
Why: Fixes a bug or regression in the existing codebase.
lib/core/romm/rom_scanner_service.dart | 30 +++++++-----------------------
1 file changed, 7 insertions(+), 23 deletions(-)
lib/core/romm/rom_scanner_service.dart
diff --git a/lib/core/romm/rom_scanner_service.dart b/lib/core/romm/rom_scanner_service.dart
index 14c463c..647f838 100644
--- a/lib/core/romm/rom_scanner_service.dart
+++ b/lib/core/romm/rom_scanner_service.dart
@@ -15,21 +15,7 @@ class RomSyncResult {
RomSyncResult(this.path, this.romId, {this.game, this.isRemoved = false});
}
-/// TOP-LEVEL function for compute() to avoid capturing 'this'
-List<String> _performIsolatedScan(List<String> paths) {
- final List<String> files = [];
- for (final path in paths) {
- final dir = Directory(path);
- if (dir.existsSync()) {
- try {
- for (final entity in dir.listSync()) {
- files.add(entity.path);
- }
- } catch (_) {}
- }
- }
- return files;
-}
+
class RomScannerService {
final RommService _rommService;
@@ -127,14 +113,12 @@ class RomScannerService {
);
// MATCHING STRATEGY 2: Clean Name match
- if (matchedGame == null) {
- matchedGame = platformGames.cast<Game?>().firstWhere((g) {
- if (g == null) return false;
- final gName = g.name.toLowerCase().replaceAll(RegExp(r'[<>:"/\\|?*!\-\(\)\[\]]'), ' ').replaceAll(RegExp(r'\s+'), ' ').trim();
- final fName = fileNameNoExt.replaceAll(RegExp(r'[<>:"/\\|?*!\-\(\)\[\]]'), ' ').replaceAll(RegExp(r'\s+'), ' ').trim();
- return gName == fName;
- }, orElse: () => null);
- }
+ matchedGame ??= platformGames.cast<Game?>().firstWhere((g) {
+ if (g == null) return false;
+ final gName = g.name.toLowerCase().replaceAll(RegExp(r'[<>:"/\\|?*!\-\(\)\[\]]'), ' ').replaceAll(RegExp(r'\s+'), ' ').trim();
+ final fName = fileNameNoExt.replaceAll(RegExp(r'[<>:"/\\|?*!\-\(\)\[\]]'), ' ').replaceAll(RegExp(r'\s+'), ' ').trim();
+ return gName == fName;
+ }, orElse: () => null);
if (matchedGame != null) {
await _mappingService.updateMapping(filePath, matchedGame.id);