diff --git a/.changes/enhance-resource-dir-linux.md b/.changes/enhance-resource-dir-linux.md new file mode 100644 index 000000000000..c528bad12467 --- /dev/null +++ b/.changes/enhance-resource-dir-linux.md @@ -0,0 +1,5 @@ +--- +"tauri-utils": patch:bug +--- + +Enhance resource directory resolution to support running on distros like NixOS. diff --git a/crates/tauri-utils/src/platform.rs b/crates/tauri-utils/src/platform.rs index 162539c9692b..7a9c99431ed5 100644 --- a/crates/tauri-utils/src/platform.rs +++ b/crates/tauri-utils/src/platform.rs @@ -309,12 +309,12 @@ fn resource_dir_from>( #[cfg(target_os = "linux")] { - res = if curr_dir.ends_with("/data/usr/bin") { - // running from the deb bundle dir - exe_dir - .join(format!("../lib/{}", package_info.name)) - .canonicalize() - .map_err(Into::into) + // (canonicalize checks for existence, so there's no need for an extra check) + res = if let Ok(bundle_dir) = exe_dir + .join(format!("../lib/{}", package_info.name)) + .canonicalize() + { + Ok(bundle_dir) } else if let Some(appdir) = &env.appdir { let appdir: &std::path::Path = appdir.as_ref(); Ok(PathBuf::from(format!(