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
					
				| @ -51,8 +51,7 @@ impl FileAssetReader { | |||||||
|     /// Returns the base path of the assets directory, which is normally the executable's parent
 |     /// Returns the base path of the assets directory, which is normally the executable's parent
 | ||||||
|     /// directory.
 |     /// directory.
 | ||||||
|     ///
 |     ///
 | ||||||
|     /// If the `CARGO_MANIFEST_DIR` environment variable is set, then its value will be used
 |     /// To change this, set [`AssetPlugin.file_path`].
 | ||||||
|     /// instead. It's set by cargo when running with `cargo run`.
 |  | ||||||
|     pub fn get_base_path() -> PathBuf { |     pub fn get_base_path() -> PathBuf { | ||||||
|         get_base_path() |         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"),
 |     // 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.
 |     // where "ROOT" is the directory of the Application.
 | ||||||
|     //
 |     //
 | ||||||
|     // This can be overridden by setting the "CARGO_MANIFEST_DIR" environment variable (see
 |     // This can be overridden by setting [`AssetPlugin.file_path`].
 | ||||||
|     // 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.
 |  | ||||||
|     let cube_handle = asset_server.load( |     let cube_handle = asset_server.load( | ||||||
|         GltfAssetLabel::Primitive { |         GltfAssetLabel::Primitive { | ||||||
|             mesh: 0, |             mesh: 0, | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Wybe Westra
						Wybe Westra