Эх сурвалжийг харах

fix(core): resource path resolution on Linux, closes #2493

Lucas Nogueira 4 жил өмнө
parent
commit
1a28904b8e

+ 6 - 0
.changes/fix-linux-resource-path.md

@@ -0,0 +1,6 @@
+---
+"tauri-utils": patch
+"tauri": patch
+---
+
+Fixes resource directory resolution on Linux.

+ 3 - 0
core/tauri-utils/Cargo.toml

@@ -22,5 +22,8 @@ html5ever = "0.25"
 proc-macro2 = { version = "1.0", optional = true }
 quote = { version = "1.0", optional = true }
 
+[target."cfg(target_os = \"linux\")".dependencies]
+heck = "0.3"
+
 [features]
 build = [ "proc-macro2", "quote" ]

+ 6 - 0
core/tauri-utils/src/lib.rs

@@ -23,6 +23,12 @@ impl PackageInfo {
   /// Returns the application package name.
   /// On macOS and Windows it's the `name` field, and on Linux it's the `name` in `kebab-case`.
   pub fn package_name(&self) -> String {
+    #[cfg(target_os = "linux")]
+    {
+      use heck::KebabCase;
+      self.name.clone().to_kebab_case()
+    }
+    #[cfg(not(target_os = "linux"))]
     self.name.clone()
   }
 }

+ 2 - 1
examples/api/src-tauri/Cargo.lock

@@ -2898,7 +2898,7 @@ dependencies = [
 
 [[package]]
 name = "tauri"
-version = "1.0.0-beta.6"
+version = "1.0.0-beta.7"
 dependencies = [
  "attohttpc",
  "base64",
@@ -3038,6 +3038,7 @@ dependencies = [
 name = "tauri-utils"
 version = "1.0.0-beta.3"
 dependencies = [
+ "heck",
  "html5ever",
  "kuchiki",
  "phf 0.10.0",