From 557c54b5123fb9f6d7d95af2343d77279a6228a2 Mon Sep 17 00:00:00 2001 From: Jakob Hellermann Date: Tue, 5 Apr 2022 20:45:06 +0000 Subject: [PATCH] fix scene_viewer example on wasm (#4426) The scene viewer example doesn't run on wasm because it sets the asset folder to `std::env::var("CARGO_MANIFEST_DIR").unwrap()`, which isn't supported on the web. Solution: set the asset folder to `"."` instead. --- examples/tools/scene_viewer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tools/scene_viewer.rs b/examples/tools/scene_viewer.rs index 2ae16a25025ee3..a66256b80b9684 100644 --- a/examples/tools/scene_viewer.rs +++ b/examples/tools/scene_viewer.rs @@ -40,7 +40,7 @@ Controls: brightness: 1.0 / 5.0f32, }) .insert_resource(AssetServerSettings { - asset_folder: std::env::var("CARGO_MANIFEST_DIR").unwrap(), + asset_folder: std::env::var("CARGO_MANIFEST_DIR").unwrap_or_else(|_| ".".to_string()), watch_for_changes: true, }) .insert_resource(WindowDescriptor {