Create imported_assets directory with full path (#12022)
# 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.
This commit is contained in:
parent
152ee42a72
commit
4e24b68fa6
@ -75,16 +75,15 @@ impl FileAssetWriter {
|
|||||||
///
|
///
|
||||||
/// See `get_base_path` below.
|
/// See `get_base_path` below.
|
||||||
pub fn new<P: AsRef<Path> + std::fmt::Debug>(path: P, create_root: bool) -> Self {
|
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 create_root {
|
||||||
if let Err(e) = std::fs::create_dir_all(&path) {
|
if let Err(e) = std::fs::create_dir_all(&root_path) {
|
||||||
error!(
|
error!(
|
||||||
"Failed to create root directory {:?} for file asset writer: {:?}",
|
"Failed to create root directory {:?} for file asset writer: {:?}",
|
||||||
path, e
|
root_path, e
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Self {
|
Self { root_path }
|
||||||
root_path: get_base_path().join(path.as_ref()),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user