ignore files starting with . when loading folders (#11214)
# Objective - When loading a folder with dot files inside, Bevy crashes: ``` thread 'IO Task Pool (1)' panicked at crates/bevy_asset/src/io/mod.rs:260:10: asset paths must have extensions note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` - those files are common for other tools to store their settings/metadata ## Solution - Ignore files starting with a dot when loading folders
This commit is contained in:
parent
235257ff62
commit
31c2dc591d
@ -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())
|
||||
})
|
||||
|
@ -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())
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user