skip descending into local

This commit is contained in:
2025-11-14 11:08:37 +01:00
parent 75be55d255
commit f88fa5794c
+17 -10
View File
@@ -2558,6 +2558,16 @@ fn is_virtual_interface(name: &str) -> bool {
VIRTUAL_HINTS.iter().any(|hint| lower.contains(hint)) VIRTUAL_HINTS.iter().any(|hint| lower.contains(hint))
} }
#[cfg(target_os = "windows")]
fn is_local_dir_name(name: &str) -> bool {
name.eq_ignore_ascii_case("local")
}
#[cfg(not(target_os = "windows"))]
fn is_local_dir_name(name: &str) -> bool {
name == "local"
}
async fn get_game_file_descriptions( async fn get_game_file_descriptions(
game_id: &str, game_id: &str,
game_dir: &str, game_dir: &str,
@@ -2574,22 +2584,18 @@ async fn get_game_file_descriptions(
let mut file_descriptions = Vec::new(); let mut file_descriptions = Vec::new();
let local_dir = game_path.join("local");
for entry in walkdir::WalkDir::new(&game_path) for entry in walkdir::WalkDir::new(&game_path)
.into_iter() .into_iter()
.filter_entry(|entry| { .filter_entry(|entry| {
let path = entry.path(); if entry.depth() == 1 {
if entry.file_type().is_dir()
// Skip the local install folder; it's not meant to sync. && entry.file_name().to_str().is_some_and(is_local_dir_name)
if path.starts_with(&local_dir) { {
// Skip the local install folder entirely so WalkDir never enters it.
return false; return false;
} }
// Root-level exclusions only. if let Some(name) = entry.file_name().to_str() {
if entry.depth() == 1
&& let Some(name) = path.file_name().and_then(|n| n.to_str())
{
if entry.file_type().is_dir() && name == ".sync" { if entry.file_type().is_dir() && name == ".sync" {
return false; return false;
} }
@@ -2597,6 +2603,7 @@ async fn get_game_file_descriptions(
return false; return false;
} }
} }
}
true true
}) })