Skip to content

Commit

Permalink
Create imported_assets directory with full path (bevyengine#12022)
Browse files Browse the repository at this point in the history
# Objective

- The file asset source currently creates the `imported_assets/Default`
directory with relative path, which leads to wrongly created directories
when the executable is run with a working directory different from the
project root.

## Solution

- Use the full path instead.
  • Loading branch information
infmagic2047 authored and msvbg committed Feb 26, 2024
1 parent 10320ee commit 26b9ea1
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions crates/bevy_asset/src/io/file/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,15 @@ impl FileAssetWriter {
///
/// See `get_base_path` below.
pub fn new<P: AsRef<Path> + std::fmt::Debug>(path: P, create_root: bool) -> Self {
let root_path = get_base_path().join(path.as_ref());
if create_root {
if let Err(e) = std::fs::create_dir_all(&path) {
if let Err(e) = std::fs::create_dir_all(&root_path) {
error!(
"Failed to create root directory {:?} for file asset writer: {:?}",
path, e
root_path, e
);
}
}
Self {
root_path: get_base_path().join(path.as_ref()),
}
Self { root_path }
}
}

0 comments on commit 26b9ea1

Please sign in to comment.