Skip to content

Commit 498d0a3

Browse files
Simply get asset path function
Signed-off-by: Akaalroop Singh <akaal@akaalroop.com>
1 parent 2951998 commit 498d0a3

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/main.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,19 @@ fn get_asset_path(asset: &str) -> String {
3636
if cfg!(debug_assertions) || cfg!(target_arch = "wasm32") {
3737
format!("assets/{}", asset)
3838
} else {
39-
let exe_path = env::current_exe()
40-
.unwrap_or_else(|e| panic!("Failed to get current executable path: {}", e));
39+
let exe_path = env::current_exe().expect("Failed to get current executable path");
4140

4241
let exe_dir = exe_path
4342
.parent()
44-
.unwrap_or_else(|| panic!("Failed to get executable directory"));
43+
.expect("Failed to get executable directory");
4544

4645
let mut asset_path = exe_dir.to_path_buf();
4746
asset_path.push("assets");
4847
asset_path.push(asset);
4948

5049
asset_path
5150
.to_str()
52-
.unwrap_or_else(|| panic!("Failed to convert path to string"))
51+
.expect("Failed to convert path to string")
5352
.to_string()
5453
}
5554
}

0 commit comments

Comments
 (0)