diff --git a/Cargo.lock b/Cargo.lock index a8a347f1..0da99351 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -766,9 +766,9 @@ dependencies = [ [[package]] name = "borsh" -version = "1.3.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f58b559fd6448c6e2fd0adb5720cd98a2506594cafa4737ff98c396f3e82f667" +checksum = "26d4d6dafc1a3bb54687538972158f07b2c948bc57d5890df22c0739098b3028" dependencies = [ "borsh-derive", "cfg_aliases 0.1.1", @@ -776,12 +776,12 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.3.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7aadb5b6ccbd078890f6d7003694e33816e6b784358f18e15e7e6d9f065a57cd" +checksum = "bf4918709cc4dd777ad2b6303ed03cb37f3ca0ccede8c1b0d28ac6db8f4710e0" dependencies = [ "once_cell", - "proc-macro-crate 3.1.0", + "proc-macro-crate 2.0.2", "proc-macro2", "quote", "syn 2.0.79", @@ -956,7 +956,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a969e13a7589e9e3e4207e153bae624ade2b5622fb4684a4923b23ec3d57719" dependencies = [ "serde", - "toml 0.8.10", + "toml 0.8.2", ] [[package]] @@ -1908,7 +1908,7 @@ dependencies = [ "cc", "memchr", "rustc_version", - "toml 0.8.10", + "toml 0.8.2", "vswhom", "winreg 0.52.0", ] @@ -2593,7 +2593,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bb0228f477c0900c880fd78c8759b95c7636dbd7842707f49e132378aa2acdc" dependencies = [ "heck 0.4.1", - "proc-macro-crate 2.0.0", + "proc-macro-crate 2.0.2", "proc-macro-error", "proc-macro2", "quote", @@ -3881,13 +3881,12 @@ dependencies = [ [[package]] name = "nix" -version = "0.28.0" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" +checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" dependencies = [ "bitflags 2.6.0", "cfg-if", - "cfg_aliases 0.1.1", "libc", "memoffset 0.9.1", ] @@ -4061,7 +4060,7 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ - "proc-macro-crate 3.1.0", + "proc-macro-crate 2.0.2", "proc-macro2", "quote", "syn 2.0.79", @@ -4829,20 +4828,12 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" -dependencies = [ - "toml_edit 0.20.7", -] - -[[package]] -name = "proc-macro-crate" -version = "3.1.0" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +checksum = "b00f26d3400549137f92511a46ac1cd8ce37cb5598a96d382381458b992a5d24" dependencies = [ - "toml_edit 0.21.1", + "toml_datetime", + "toml_edit 0.20.2", ] [[package]] @@ -6536,7 +6527,7 @@ dependencies = [ "cfg-expr", "heck 0.5.0", "pkg-config", - "toml 0.8.10", + "toml 0.8.2", "version-compare", ] @@ -6687,7 +6678,7 @@ dependencies = [ "tauri-codegen", "tauri-utils", "tauri-winres", - "toml 0.8.10", + "toml 0.8.2", "walkdir", ] @@ -6745,7 +6736,7 @@ dependencies = [ "serde", "serde_json", "tauri-utils", - "toml 0.8.10", + "toml 0.8.2", "walkdir", ] @@ -7051,6 +7042,7 @@ dependencies = [ name = "tauri-plugin-shell" version = "2.0.2" dependencies = [ + "dunce", "encoding_rs", "log", "open", @@ -7287,7 +7279,7 @@ dependencies = [ "serialize-to-javascript", "swift-rs", "thiserror", - "toml 0.8.10", + "toml 0.8.2", "url", "urlpattern", "uuid", @@ -7574,21 +7566,21 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.10" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a9aad4a3066010876e8dcf5a8a06e70a558751117a145c6ce2b82c2e2054290" +checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.6", + "toml_edit 0.20.2", ] [[package]] name = "toml_datetime" -version = "0.6.5" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" dependencies = [ "serde", ] @@ -7603,42 +7595,20 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "winnow 0.5.40", -] - -[[package]] -name = "toml_edit" -version = "0.20.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" -dependencies = [ - "indexmap 2.6.0", - "toml_datetime", - "winnow 0.5.40", -] - -[[package]] -name = "toml_edit" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" -dependencies = [ - "indexmap 2.6.0", - "toml_datetime", - "winnow 0.5.40", + "winnow", ] [[package]] name = "toml_edit" -version = "0.22.6" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c1b5fd4128cc8d3e0cb74d4ed9a9cc7c7284becd4df68f5f940e1ad123606f6" +checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" dependencies = [ "indexmap 2.6.0", "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.2", + "winnow", ] [[package]] @@ -8815,15 +8785,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "winnow" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a4191c47f15cc3ec71fcb4913cb83d58def65dd3787610213c649283b5ce178" -dependencies = [ - "memchr", -] - [[package]] name = "winreg" version = "0.10.1" @@ -8965,9 +8926,9 @@ dependencies = [ [[package]] name = "zbus" -version = "4.1.2" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9ff46f2a25abd690ed072054733e0bc3157e3d4c45f41bd183dce09c2ff8ab9" +checksum = "7b8e3d6ae3342792a6cc2340e4394334c7402f3d793b390d2c5494a4032b3030" dependencies = [ "async-broadcast", "async-executor", @@ -8986,7 +8947,7 @@ dependencies = [ "futures-sink", "futures-util", "hex", - "nix 0.28.0", + "nix 0.27.1", "ordered-stream", "rand 0.8.5", "serde", @@ -9005,11 +8966,11 @@ dependencies = [ [[package]] name = "zbus_macros" -version = "4.1.2" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e0e3852c93dcdb49c9462afe67a2a468f7bd464150d866e861eaf06208633e0" +checksum = "b7a3e850ff1e7217a3b7a07eba90d37fe9bb9e89a310f718afcde5885ca9b6d7" dependencies = [ - "proc-macro-crate 3.1.0", + "proc-macro-crate 1.3.1", "proc-macro2", "quote", "regex", @@ -9127,9 +9088,9 @@ dependencies = [ [[package]] name = "zvariant" -version = "4.0.2" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c1b3ca6db667bfada0f1ebfc94b2b1759ba25472ee5373d4551bb892616389a" +checksum = "4e09e8be97d44eeab994d752f341e67b3b0d80512a8b315a0671d47232ef1b65" dependencies = [ "endi", "enumflags2", @@ -9141,11 +9102,11 @@ dependencies = [ [[package]] name = "zvariant_derive" -version = "4.0.2" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7a4b236063316163b69039f77ce3117accb41a09567fd24c168e43491e521bc" +checksum = "72a5857e2856435331636a9fbb415b09243df4521a267c5bedcd5289b4d5799e" dependencies = [ - "proc-macro-crate 3.1.0", + "proc-macro-crate 1.3.1", "proc-macro2", "quote", "syn 1.0.109", diff --git a/plugins/shell/Cargo.toml b/plugins/shell/Cargo.toml index fda626a3..6ce62b64 100644 --- a/plugins/shell/Cargo.toml +++ b/plugins/shell/Cargo.toml @@ -37,6 +37,7 @@ regex = "1" open = { version = "5", features = ["shellexecute-on-windows"] } encoding_rs = "0.8" os_pipe = "1" +dunce = { workspace = true } [target."cfg(windows)".dependencies.windows] version = "0.54" diff --git a/plugins/shell/src/open/mod.rs b/plugins/shell/src/open/mod.rs index 23cbde59..e030d131 100644 --- a/plugins/shell/src/open/mod.rs +++ b/plugins/shell/src/open/mod.rs @@ -139,10 +139,11 @@ pub fn open>(scope: &OpenScope, path: P, with: Option) -> pub fn show_item_in_directory>(p: P) -> crate::Result<()> { let p = p.as_ref().canonicalize()?; + let p = dunce::simplified(&p); #[cfg(any( windows, - target_os = "maco", + target_os = "macos", target_os = "linux", target_os = "dragonfly", target_os = "freebsd", @@ -153,7 +154,7 @@ pub fn show_item_in_directory>(p: P) -> crate::Result< #[cfg(not(any( windows, - target_os = "maco", + target_os = "macos", target_os = "linux", target_os = "dragonfly", target_os = "freebsd", diff --git a/plugins/shell/src/open/windows.rs b/plugins/shell/src/open/windows.rs index a2ee4d5f..131a4e6b 100644 --- a/plugins/shell/src/open/windows.rs +++ b/plugins/shell/src/open/windows.rs @@ -1,4 +1,4 @@ -use std::{ffi::OsString, path::PathBuf}; +use std::path::Path; use windows::{ core::{w, HSTRING, PCWSTR}, @@ -12,18 +12,16 @@ use windows::{ }, }; -pub fn show_item_in_directory(file: PathBuf) -> crate::Result<()> { +pub fn show_item_in_directory(file: &Path) -> crate::Result<()> { let _ = unsafe { CoInitialize(None) }; let dir = file .parent() - .ok_or_else(|| crate::Error::NoParent(file.clone()))?; + .ok_or_else(|| crate::Error::NoParent(file.to_path_buf()))?; - let dir = OsString::from(dir); let dir = HSTRING::from(dir); let dir_item = unsafe { ILCreateFromPathW(PCWSTR::from_raw(dir.as_ptr())) }; - let file = OsString::from(file); let file = HSTRING::from(file); let file_item = unsafe { ILCreateFromPathW(PCWSTR::from_raw(file.as_ptr())) };