Skip to content

Commit 8124145

Browse files
authored
fix(core): path commands not added (#7171)
1 parent 6d3f313 commit 8124145

File tree

3 files changed

+24
-27
lines changed

3 files changed

+24
-27
lines changed

.changes/enable-path-commands.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch
3+
---
4+
5+
Fixes path commands not being added.

core/tauri/src/path/mod.rs

+11-19
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use serde::{de::Error as DeError, Deserialize, Deserializer};
1313
use serde_repr::{Deserialize_repr, Serialize_repr};
1414
use serialize_to_javascript::{default_template, DefaultTemplate, Template};
1515

16-
#[cfg(any(path_all, test))]
1716
mod commands;
1817
mod error;
1918
pub use error::*;
@@ -341,23 +340,6 @@ struct InitJavascript {
341340

342341
/// Initializes the plugin.
343342
pub(crate) fn init<R: Runtime>() -> TauriPlugin<R> {
344-
#[allow(unused_mut)]
345-
let mut builder = Builder::new("path");
346-
347-
#[cfg(any(path_all, test))]
348-
{
349-
builder = builder.invoke_handler(crate::generate_handler![
350-
commands::resolve_directory,
351-
commands::resolve,
352-
commands::normalize,
353-
commands::join,
354-
commands::dirname,
355-
commands::extname,
356-
commands::basename,
357-
commands::is_absolute
358-
]);
359-
}
360-
361343
#[cfg(windows)]
362344
let (sep, delimiter) = ("\\", ";");
363345
#[cfg(not(windows))]
@@ -368,7 +350,17 @@ pub(crate) fn init<R: Runtime>() -> TauriPlugin<R> {
368350
// this will never fail with the above sep and delimiter values
369351
.unwrap();
370352

371-
builder
353+
Builder::new("path")
354+
.invoke_handler(crate::generate_handler![
355+
commands::resolve_directory,
356+
commands::resolve,
357+
commands::normalize,
358+
commands::join,
359+
commands::dirname,
360+
commands::extname,
361+
commands::basename,
362+
commands::is_absolute
363+
])
372364
.js_init_script(init_js.to_string())
373365
.setup(|app, _api| {
374366
#[cfg(target_os = "android")]

examples/api/src-tauri/Cargo.lock

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)