fs: Fix directory scanning crashes and optimize library performance & Include a Progress Bar #72

Merged
Zephyron merged 19 commits from fs/linux-ntfs-fix into main 2025-12-21 02:57:33 +00:00
Collaborator

This commit addresses a critical crash occurring when scanning directories on non-Windows platforms (Linux in particular) using NTFS mounts, specifically targeting infinite recursion in junction points such as "Application Data".

Key Changes:

  • Thread Safety: Wrapped worker thread logic in try-catch blocks to prevent unhandled exceptions from reaching Qt Concurrent and triggering a std::terminate() crash.

  • Filesystem Logic: Switched from throwing std::filesystem methods to non-throwing overloads with std::error_code. Implemented a recursion depth limit and a platform-aware blacklist (#ifndef _WIN32) to skip Windows system folders and loops on non-Windows platforms.

  • Performance Optimization: Optimized GameListWorker by combining the content provider and library scans into a single pass (ScanTarget::Both), halving disk I/O and seek times on mechanical HDDs.

  • Filtering: Introduced early extension filtering to prevent the emulator from opening and probing non-game files, and fixed a double-increment bug in the directory iterator that caused some games to be skipped.

  • UI Enhancement: Added a "Scan for .nca files" toggle in UI Settings for Filesystem (defaulting to false)

  • UI Progress: Added a progress bar that showcases on top of the game_list to allow users visual representation of the progress being made scanning their directories instead of just a weird "hang".

Platform Compatibility:

  • Windows: Blacklist logic is bypassed via preprocessor macros to maintain native junction handling.

  • Linux/Android/macOS: Protects against ELOOP errors (too many symlinks) and significantly improves scan speed on external or primary Windows mounts.

  • General: Increases application stability across all platforms by ensuring worker thread exceptions are handled locally.

This commit addresses a critical crash occurring when scanning directories on non-Windows platforms (Linux in particular) using NTFS mounts, specifically targeting infinite recursion in junction points such as "Application Data". Key Changes: - Thread Safety: Wrapped worker thread logic in try-catch blocks to prevent unhandled exceptions from reaching Qt Concurrent and triggering a std::terminate() crash. - Filesystem Logic: Switched from throwing std::filesystem methods to non-throwing overloads with std::error_code. Implemented a recursion depth limit and a platform-aware blacklist (#ifndef _WIN32) to skip Windows system folders and loops on non-Windows platforms. - Performance Optimization: Optimized GameListWorker by combining the content provider and library scans into a single pass (ScanTarget::Both), halving disk I/O and seek times on mechanical HDDs. - Filtering: Introduced early extension filtering to prevent the emulator from opening and probing non-game files, and fixed a double-increment bug in the directory iterator that caused some games to be skipped. - UI Enhancement: Added a "Scan for .nca files" toggle in UI Settings for Filesystem (defaulting to false) - UI Progress: Added a progress bar that showcases on top of the game_list to allow users visual representation of the progress being made scanning their directories instead of just a weird "hang". Platform Compatibility: - Windows: Blacklist logic is bypassed via preprocessor macros to maintain native junction handling. - Linux/Android/macOS: Protects against ELOOP errors (too many symlinks) and significantly improves scan speed on external or primary Windows mounts. - General: Increases application stability across all platforms by ensuring worker thread exceptions are handled locally.
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Collecting scheduled this pull request to auto merge when all checks succeed 2025-12-19 20:57:51 +00:00
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Zephyron deleted branch fs/linux-ntfs-fix 2025-12-21 02:57:33 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Citron/Emulator!72
No description provided.