Skip to content

Commit 4340f7b

Browse files
authored
add debug logging to ascertain the base path the asset server is using (#13820)
# Objective Explicitly and exactly know what of the environment variables (if any) are being used/not-used/found-not-found by the `bevy_asset::io::file::get_base_path()`. - Describe the objective or issue this PR addresses: In a sufficiently complex project, with enough crates and such it _can_ be hard to know what the Asset Server is using as, what in the bevy parlance is its 'base path', this change seems to be the lowest effort to discovering that. ## Solution - Added `debug!` logging to the `FileAssetReader::new()` call. ## Testing See output by making a project and trying something like `RUST_LOG=bevy_asset::io::file=debug cargo run` - Ran Bevy's tests. - How can other people (reviewers) test your changes?: Intentionally mess with your `env` variables (BEVY_ASSET_ROOT and CARGO_MANIFEST_DIR, scatter assets about and attempt to (without this change) locate where it's going wrong. - Is there anything specific they need to know?: I encountered this issue in a rather large workspace with many many crates with multiple nested asset directories. - If relevant, what platforms did you test these changes on, and are there any important ones you can't test? Linux. ---
1 parent fcda67e commit 4340f7b

File tree

1 file changed

+5
-1
lines changed
  • crates/bevy_asset/src/io/file

1 file changed

+5
-1
lines changed

crates/bevy_asset/src/io/file/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ mod file_asset;
66
#[cfg(not(feature = "multi_threaded"))]
77
mod sync_file_asset;
88

9-
use bevy_utils::tracing::error;
9+
use bevy_utils::tracing::{debug, error};
1010
#[cfg(feature = "file_watcher")]
1111
pub use file_watcher::*;
1212

@@ -41,6 +41,10 @@ impl FileAssetReader {
4141
/// See `get_base_path` below.
4242
pub fn new<P: AsRef<Path>>(path: P) -> Self {
4343
let root_path = Self::get_base_path().join(path.as_ref());
44+
debug!(
45+
"Asset Server using {} as its base path.",
46+
root_path.display()
47+
);
4448
Self { root_path }
4549
}
4650

0 commit comments

Comments
 (0)