diff --git a/crates/bevy_asset/src/io/file/file_asset.rs b/crates/bevy_asset/src/io/file/file_asset.rs index f65680217b..58ae546e7f 100644 --- a/crates/bevy_asset/src/io/file/file_asset.rs +++ b/crates/bevy_asset/src/io/file/file_asset.rs @@ -74,6 +74,15 @@ impl AssetReader for FileAssetReader { return None; } } + // filter out hidden files. they are not listed by default but are directly targetable + if path + .file_name() + .and_then(|file_name| file_name.to_str()) + .map(|file_name| file_name.starts_with('.')) + .unwrap_or_default() + { + return None; + } let relative_path = path.strip_prefix(&root_path).unwrap(); Some(relative_path.to_owned()) }) diff --git a/crates/bevy_asset/src/io/file/sync_file_asset.rs b/crates/bevy_asset/src/io/file/sync_file_asset.rs index 7533256204..9281d323c8 100644 --- a/crates/bevy_asset/src/io/file/sync_file_asset.rs +++ b/crates/bevy_asset/src/io/file/sync_file_asset.rs @@ -145,6 +145,16 @@ impl AssetReader for FileAssetReader { return None; } } + // filter out hidden files. they are not listed by default but are directly targetable + if path + .file_name() + .and_then(|file_name| file_name.to_str()) + .map(|file_name| file_name.starts_with('.')) + .unwrap_or_default() + { + return None; + } + let relative_path = path.strip_prefix(&root_path).unwrap(); Some(relative_path.to_owned()) })