Skip to content

Commit

Permalink
BEVY_ASSET_ROOT with higher priority than CARGO_MANIFEST_DIR + update…
Browse files Browse the repository at this point in the history
…d doc
  • Loading branch information
Vrixyz committed Jul 17, 2022
1 parent 3615a4a commit d6b6d5a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions crates/bevy_asset/src/io/file_asset_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,15 @@ impl FileAssetIo {
/// Returns the base path of the assets directory, which is normally the executable's parent
/// directory.
///
/// If the `CARGO_MANIFEST_DIR` environment variable is set, then its value will be used
/// If a `BEVY_ASSET_ROOT` environment variable is set, then its value will be used.
///
/// Else if the `CARGO_MANIFEST_DIR` environment variable is set, then its value will be used
/// instead. It's set by cargo when running with `cargo run`.
pub fn get_base_path() -> PathBuf {
if let Ok(manifest_dir) = env::var("CARGO_MANIFEST_DIR") {
PathBuf::from(manifest_dir)
} else if let Ok(env_bevy_asset_root) = env::var("BEVY_ASSET_ROOT") {
if let Ok(env_bevy_asset_root) = env::var("BEVY_ASSET_ROOT") {
PathBuf::from(env_bevy_asset_root)
} else if let Ok(manifest_dir) = env::var("CARGO_MANIFEST_DIR") {
PathBuf::from(manifest_dir)
} else {
env::current_exe()
.map(|path| {
Expand Down

0 comments on commit d6b6d5a

Please sign in to comment.