mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
Reccomend using AssetPlugin.file_path
instead of CARGO_MANIFEST_DIR (#15176)
Fixes #15175.
One question I have: I see that the scene_viewer example uses the
CARGO_MANIFEST_DIR. Should that line be removed, or would that break the
tool?
1fd478277e/examples/tools/scene_viewer/main.rs (L40)
This commit is contained in:
parent
1b1105e327
commit
ae80a20690
2 changed files with 2 additions and 6 deletions
|
@ -51,8 +51,7 @@ impl FileAssetReader {
|
|||
/// 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
|
||||
/// instead. It's set by cargo when running with `cargo run`.
|
||||
/// To change this, set [`AssetPlugin.file_path`].
|
||||
pub fn get_base_path() -> PathBuf {
|
||||
get_base_path()
|
||||
}
|
||||
|
|
|
@ -19,10 +19,7 @@ fn setup(
|
|||
// For example, the next line will load GltfAssetLabel::Primitive{mesh:0,primitive:0}.from_asset("ROOT/assets/models/cube/cube.gltf"),
|
||||
// where "ROOT" is the directory of the Application.
|
||||
//
|
||||
// This can be overridden by setting the "CARGO_MANIFEST_DIR" environment variable (see
|
||||
// https://doc.rust-lang.org/cargo/reference/environment-variables.html)
|
||||
// to another directory. When the Application is run through Cargo, "CARGO_MANIFEST_DIR" is
|
||||
// automatically set to your crate (workspace) root directory.
|
||||
// This can be overridden by setting [`AssetPlugin.file_path`].
|
||||
let cube_handle = asset_server.load(
|
||||
GltfAssetLabel::Primitive {
|
||||
mesh: 0,
|
||||
|
|
Loading…
Reference in a new issue