Skip to content

Commit a5c1a20

Browse files
committed
Canonicalize CARGO_MANIFEST_DIR in case it's set as a relpath and causes crashes FileAssetIo's strip_prefix.
1 parent f1be89d commit a5c1a20

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

crates/bevy_asset/src/io/file_asset_io.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ impl FileAssetIo {
6464
/// instead. It's set by cargo when running with `cargo run`.
6565
pub fn get_base_path() -> PathBuf {
6666
if let Ok(manifest_dir) = env::var("CARGO_MANIFEST_DIR") {
67-
PathBuf::from(manifest_dir)
67+
fs::canonicalize(&manifest_dir)
68+
.unwrap_or_else(|_| PathBuf::from(manifest_dir))
6869
} else {
6970
env::current_exe()
7071
.map(|path| {

0 commit comments

Comments
 (0)