From 8124145d6c6a629809c138d2c34082e1feb4fdbf Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Thu, 8 Jun 2023 17:08:46 -0700 Subject: [PATCH] fix(core): path commands not added (#7171) --- .changes/enable-path-commands.md | 5 +++++ core/tauri/src/path/mod.rs | 30 +++++++++++------------------- examples/api/src-tauri/Cargo.lock | 16 ++++++++-------- 3 files changed, 24 insertions(+), 27 deletions(-) create mode 100644 .changes/enable-path-commands.md diff --git a/.changes/enable-path-commands.md b/.changes/enable-path-commands.md new file mode 100644 index 000000000..28e4d1570 --- /dev/null +++ b/.changes/enable-path-commands.md @@ -0,0 +1,5 @@ +--- +"tauri": patch +--- + +Fixes path commands not being added. diff --git a/core/tauri/src/path/mod.rs b/core/tauri/src/path/mod.rs index a8b2e171f..ef6c2a7b9 100644 --- a/core/tauri/src/path/mod.rs +++ b/core/tauri/src/path/mod.rs @@ -13,7 +13,6 @@ use serde::{de::Error as DeError, Deserialize, Deserializer}; use serde_repr::{Deserialize_repr, Serialize_repr}; use serialize_to_javascript::{default_template, DefaultTemplate, Template}; -#[cfg(any(path_all, test))] mod commands; mod error; pub use error::*; @@ -341,23 +340,6 @@ struct InitJavascript { /// Initializes the plugin. pub(crate) fn init() -> TauriPlugin { - #[allow(unused_mut)] - let mut builder = Builder::new("path"); - - #[cfg(any(path_all, test))] - { - builder = builder.invoke_handler(crate::generate_handler![ - commands::resolve_directory, - commands::resolve, - commands::normalize, - commands::join, - commands::dirname, - commands::extname, - commands::basename, - commands::is_absolute - ]); - } - #[cfg(windows)] let (sep, delimiter) = ("\\", ";"); #[cfg(not(windows))] @@ -368,7 +350,17 @@ pub(crate) fn init() -> TauriPlugin { // this will never fail with the above sep and delimiter values .unwrap(); - builder + Builder::new("path") + .invoke_handler(crate::generate_handler![ + commands::resolve_directory, + commands::resolve, + commands::normalize, + commands::join, + commands::dirname, + commands::extname, + commands::basename, + commands::is_absolute + ]) .js_init_script(init_js.to_string()) .setup(|app, _api| { #[cfg(target_os = "android")] diff --git a/examples/api/src-tauri/Cargo.lock b/examples/api/src-tauri/Cargo.lock index 55ed3206f..2659cfdc3 100644 --- a/examples/api/src-tauri/Cargo.lock +++ b/examples/api/src-tauri/Cargo.lock @@ -2226,9 +2226,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.59" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] @@ -2528,18 +2528,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.163" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" +checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.163" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" +checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" dependencies = [ "proc-macro2", "quote", @@ -3187,9 +3187,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.21" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3403384eaacbca9923fa06940178ac13e4edb725486d70e8e15881d0c836cc" +checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd" dependencies = [ "itoa 1.0.6", "libc",