Skip to content

Commit

Permalink
add to lower case to make asset loading case insensitive (#1427)
Browse files Browse the repository at this point in the history
This should fix bug #1425
  • Loading branch information
Archina committed Mar 3, 2021
1 parent 8dcba7f commit b8a0ab0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion crates/bevy_asset/src/asset_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,13 @@ impl AssetServer {
extensions: Vec::new(),
})?
.to_str()
.map(|s| s.to_lowercase())
.ok_or(AssetServerError::MissingAssetLoader {
extensions: Vec::new(),
})?;

let mut exts = Vec::new();
let mut ext = s;
let mut ext = s.as_str();
while let Some(idx) = ext.find('.') {
ext = &ext[idx + 1..];
exts.push(ext);
Expand Down Expand Up @@ -552,6 +553,13 @@ mod test {
assert_eq!(t.unwrap().extensions()[0], "png");
}

#[test]
fn case_insensitive_extensions() {
let asset_server = setup();
let t = asset_server.get_path_asset_loader("test.PNG");
assert_eq!(t.unwrap().extensions()[0], "png");
}

#[test]
fn no_loader() {
let asset_server = setup();
Expand Down

0 comments on commit b8a0ab0

Please sign in to comment.