diff --git a/crates/asset_transport/src/discover.rs b/crates/asset_transport/src/discover.rs index c715197..cf35515 100644 --- a/crates/asset_transport/src/discover.rs +++ b/crates/asset_transport/src/discover.rs @@ -250,6 +250,28 @@ fn game_files(root: &Path) -> impl Iterator> { files_under(search_roots(root)) } +/// Folders the game never keeps zones in: cargo's output when the games root is the build's own +/// `target/play` (tens of thousands of files, walked on every discovery), and our own +/// artifacts. +const NOT_GAME_DIRS: [&str; 6] = [ + "incremental", + "deps", + "build", + ".fingerprint", + "examples", + "iw4l-artifacts", +]; + +fn is_not_game_dir(path: &Path) -> bool { + path.file_name() + .and_then(|name| name.to_str()) + .is_some_and(|name| { + NOT_GAME_DIRS + .iter() + .any(|skip| name.eq_ignore_ascii_case(skip)) + }) +} + fn files_under(roots: Vec) -> impl Iterator> { let mut pending: VecDeque<_> = roots.into_iter().map(Ok).collect(); let mut visited = HashSet::new(); @@ -259,6 +281,9 @@ fn files_under(roots: Vec) -> impl Iterator path, Err(error) => return Some(Err(error)), }; + if is_not_game_dir(&path) { + continue; + } let canonical = match std::fs::canonicalize(&path) { Ok(path) => path, Err(error) => {