skip descending into local
This commit is contained in:
@@ -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,27 +2584,24 @@ 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) {
|
{
|
||||||
return false;
|
// Skip the local install folder entirely so WalkDir never enters it.
|
||||||
}
|
|
||||||
|
|
||||||
// Root-level exclusions only.
|
|
||||||
if entry.depth() == 1
|
|
||||||
&& let Some(name) = path.file_name().and_then(|n| n.to_str())
|
|
||||||
{
|
|
||||||
if entry.file_type().is_dir() && name == ".sync" {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if entry.file_type().is_file() && name == ".softlan_game_installed" {
|
|
||||||
return false;
|
if let Some(name) = entry.file_name().to_str() {
|
||||||
|
if entry.file_type().is_dir() && name == ".sync" {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if entry.file_type().is_file() && name == ".softlan_game_installed" {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user