From 944400d1ad190114aef7fc397f0d1d5c2565dc7d Mon Sep 17 00:00:00 2001 From: mtkennerly Date: Tue, 8 Aug 2023 08:06:27 +0800 Subject: [PATCH] #250: Ignore file names containing a backslash --- CHANGELOG.md | 3 +++ src/scan.rs | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b37b4c7..5291a570 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,9 @@ * Fixed: * Detection of saves associated with the Ubisoft Game Launcher folder on Linux when installed with Steam and Proton. + * On non-Windows systems, when recursively finding files in a directory, + file names containing a backslash would cause an error. + For now, these files will be ignored until they are properly supported. ## v0.20.0 (2023-07-10) diff --git a/src/scan.rs b/src/scan.rs index e75a048f..d592a2ce 100644 --- a/src/scan.rs +++ b/src/scan.rs @@ -561,6 +561,12 @@ pub fn scan_game_for_backup( .filter_map(filter_map_walkdir) { if child.file_type().is_file() { + #[cfg(not(target_os = "windows"))] + if child.file_name().to_string_lossy().contains('\\') { + // TODO: Support file names containing a slash. + continue; + } + let child = StrictPath::from(&child).rendered(); if filter.is_path_ignored(&child) { log::debug!("[{name}] excluded: {}", child.raw());