chore(deps): migrate dirs_next to dirs (#9929)

This commit is contained in:
Tony 2024-06-04 11:03:25 +08:00 committed by GitHub
parent e6e17ad1c8
commit f955f7b490
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 78 additions and 57 deletions

View File

@ -0,0 +1,9 @@
---
"tauri": patch:deps
"tauri-build": patch:deps
"tauri-bundler": patch:deps
"tauri-cli": patch:deps
"@tauri-apps/cli": patch:deps
---
Switch from `dirs_next` to `dirs` as `dirs_next` is now unmaintained while `dirs` is

34
Cargo.lock generated
View File

@ -665,24 +665,24 @@ dependencies = [
]
[[package]]
name = "dirs-next"
version = "2.0.0"
name = "dirs"
version = "5.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1"
checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225"
dependencies = [
"cfg-if",
"dirs-sys-next",
"dirs-sys",
]
[[package]]
name = "dirs-sys-next"
version = "0.1.2"
name = "dirs-sys"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c"
dependencies = [
"libc",
"option-ext",
"redox_users",
"winapi",
"windows-sys 0.48.0",
]
[[package]]
@ -2177,6 +2177,12 @@ dependencies = [
"vcpkg",
]
[[package]]
name = "option-ext"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
[[package]]
name = "overload"
version = "0.1.1"
@ -3534,7 +3540,7 @@ dependencies = [
"cargo_toml",
"cocoa",
"data-url",
"dirs-next",
"dirs",
"dunce",
"embed_plist",
"futures-util",
@ -3600,7 +3606,7 @@ version = "2.0.0-beta.17"
dependencies = [
"anyhow",
"cargo_toml",
"dirs-next",
"dirs",
"glob",
"heck 0.5.0",
"json-patch",
@ -4087,14 +4093,14 @@ dependencies = [
[[package]]
name = "tray-icon"
version = "0.14.0"
version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f79da804c7d1fd82da182b39d4fe5ac1044b08117358b23b41daf88840a3e70d"
checksum = "0b27516dfcfa22a9faaf192283a122bfbede38c1e59ef194e3c4db6549b419c0"
dependencies = [
"cocoa",
"core-graphics",
"crossbeam-channel",
"dirs-next",
"dirs",
"libappindicator",
"muda",
"objc",

View File

@ -38,7 +38,7 @@ json-patch = "1.2"
walkdir = "2"
tauri-winres = "0.1"
semver = "1"
dirs-next = "2"
dirs = "5"
glob = "0.3"
toml = "0.8"
schemars = { version = "0.8.18", features = [ "preserve_order" ] }

View File

@ -198,7 +198,7 @@ fn copy_frameworks(dest_dir: &Path, frameworks: &[String]) -> Result<()> {
framework
));
}
if let Some(home_dir) = dirs_next::home_dir() {
if let Some(home_dir) = dirs::home_dir() {
if copy_framework_from(&home_dir.join("Library/Frameworks/"), framework, dest_dir)? {
continue;
}

View File

@ -59,7 +59,7 @@ getrandom = "0.2"
serde_repr = "0.1"
state = "0.6"
http = "1.1"
dirs-next = "2.0"
dirs = "5"
percent-encoding = "2.3"
reqwest = { version = "0.12", default-features = false, features = [ "json", "stream" ] }
bytes = { version = "1", features = [ "serde" ] }

View File

@ -18,7 +18,7 @@ impl<R: Runtime> PathResolver<R> {
/// - **macOS:** Resolves to `$HOME/Music`.
/// - **Windows:** Resolves to `{FOLDERID_Music}`.
pub fn audio_dir(&self) -> Result<PathBuf> {
dirs_next::audio_dir().ok_or(Error::UnknownPath)
dirs::audio_dir().ok_or(Error::UnknownPath)
}
/// Returns the path to the user's cache directory.
@ -29,7 +29,7 @@ impl<R: Runtime> PathResolver<R> {
/// - **macOS:** Resolves to `$HOME/Library/Caches`.
/// - **Windows:** Resolves to `{FOLDERID_LocalAppData}`.
pub fn cache_dir(&self) -> Result<PathBuf> {
dirs_next::cache_dir().ok_or(Error::UnknownPath)
dirs::cache_dir().ok_or(Error::UnknownPath)
}
/// Returns the path to the user's config directory.
@ -40,7 +40,7 @@ impl<R: Runtime> PathResolver<R> {
/// - **macOS:** Resolves to `$HOME/Library/Application Support`.
/// - **Windows:** Resolves to `{FOLDERID_RoamingAppData}`.
pub fn config_dir(&self) -> Result<PathBuf> {
dirs_next::config_dir().ok_or(Error::UnknownPath)
dirs::config_dir().ok_or(Error::UnknownPath)
}
/// Returns the path to the user's data directory.
@ -51,7 +51,7 @@ impl<R: Runtime> PathResolver<R> {
/// - **macOS:** Resolves to `$HOME/Library/Application Support`.
/// - **Windows:** Resolves to `{FOLDERID_RoamingAppData}`.
pub fn data_dir(&self) -> Result<PathBuf> {
dirs_next::data_dir().ok_or(Error::UnknownPath)
dirs::data_dir().ok_or(Error::UnknownPath)
}
/// Returns the path to the user's local data directory.
@ -62,7 +62,7 @@ impl<R: Runtime> PathResolver<R> {
/// - **macOS:** Resolves to `$HOME/Library/Application Support`.
/// - **Windows:** Resolves to `{FOLDERID_LocalAppData}`.
pub fn local_data_dir(&self) -> Result<PathBuf> {
dirs_next::data_local_dir().ok_or(Error::UnknownPath)
dirs::data_local_dir().ok_or(Error::UnknownPath)
}
/// Returns the path to the user's desktop directory.
@ -73,7 +73,7 @@ impl<R: Runtime> PathResolver<R> {
/// - **macOS:** Resolves to `$HOME/Desktop`.
/// - **Windows:** Resolves to `{FOLDERID_Desktop}`.
pub fn desktop_dir(&self) -> Result<PathBuf> {
dirs_next::desktop_dir().ok_or(Error::UnknownPath)
dirs::desktop_dir().ok_or(Error::UnknownPath)
}
/// Returns the path to the user's document directory.
@ -84,7 +84,7 @@ impl<R: Runtime> PathResolver<R> {
/// - **macOS:** Resolves to `$HOME/Documents`.
/// - **Windows:** Resolves to `{FOLDERID_Documents}`.
pub fn document_dir(&self) -> Result<PathBuf> {
dirs_next::document_dir().ok_or(Error::UnknownPath)
dirs::document_dir().ok_or(Error::UnknownPath)
}
/// Returns the path to the user's download directory.
@ -95,7 +95,7 @@ impl<R: Runtime> PathResolver<R> {
/// - **macOS:** Resolves to `$HOME/Downloads`.
/// - **Windows:** Resolves to `{FOLDERID_Downloads}`.
pub fn download_dir(&self) -> Result<PathBuf> {
dirs_next::download_dir().ok_or(Error::UnknownPath)
dirs::download_dir().ok_or(Error::UnknownPath)
}
/// Returns the path to the user's executable directory.
@ -106,7 +106,7 @@ impl<R: Runtime> PathResolver<R> {
/// - **macOS:** Not supported.
/// - **Windows:** Not supported.
pub fn executable_dir(&self) -> Result<PathBuf> {
dirs_next::executable_dir().ok_or(Error::UnknownPath)
dirs::executable_dir().ok_or(Error::UnknownPath)
}
/// Returns the path to the user's font directory.
@ -117,7 +117,7 @@ impl<R: Runtime> PathResolver<R> {
/// - **macOS:** Resolves to `$HOME/Library/Fonts`.
/// - **Windows:** Not supported.
pub fn font_dir(&self) -> Result<PathBuf> {
dirs_next::font_dir().ok_or(Error::UnknownPath)
dirs::font_dir().ok_or(Error::UnknownPath)
}
/// Returns the path to the user's home directory.
@ -128,7 +128,7 @@ impl<R: Runtime> PathResolver<R> {
/// - **macOS:** Resolves to `$HOME`.
/// - **Windows:** Resolves to `{FOLDERID_Profile}`.
pub fn home_dir(&self) -> Result<PathBuf> {
dirs_next::home_dir().ok_or(Error::UnknownPath)
dirs::home_dir().ok_or(Error::UnknownPath)
}
/// Returns the path to the user's picture directory.
@ -139,7 +139,7 @@ impl<R: Runtime> PathResolver<R> {
/// - **macOS:** Resolves to `$HOME/Pictures`.
/// - **Windows:** Resolves to `{FOLDERID_Pictures}`.
pub fn picture_dir(&self) -> Result<PathBuf> {
dirs_next::picture_dir().ok_or(Error::UnknownPath)
dirs::picture_dir().ok_or(Error::UnknownPath)
}
/// Returns the path to the user's public directory.
@ -150,7 +150,7 @@ impl<R: Runtime> PathResolver<R> {
/// - **macOS:** Resolves to `$HOME/Public`.
/// - **Windows:** Resolves to `{FOLDERID_Public}`.
pub fn public_dir(&self) -> Result<PathBuf> {
dirs_next::public_dir().ok_or(Error::UnknownPath)
dirs::public_dir().ok_or(Error::UnknownPath)
}
/// Returns the path to the user's runtime directory.
@ -161,7 +161,7 @@ impl<R: Runtime> PathResolver<R> {
/// - **macOS:** Not supported.
/// - **Windows:** Not supported.
pub fn runtime_dir(&self) -> Result<PathBuf> {
dirs_next::runtime_dir().ok_or(Error::UnknownPath)
dirs::runtime_dir().ok_or(Error::UnknownPath)
}
/// Returns the path to the user's template directory.
@ -172,7 +172,7 @@ impl<R: Runtime> PathResolver<R> {
/// - **macOS:** Not supported.
/// - **Windows:** Resolves to `{FOLDERID_Templates}`.
pub fn template_dir(&self) -> Result<PathBuf> {
dirs_next::template_dir().ok_or(Error::UnknownPath)
dirs::template_dir().ok_or(Error::UnknownPath)
}
/// Returns the path to the user's video dir
@ -183,7 +183,7 @@ impl<R: Runtime> PathResolver<R> {
/// - **macOS:** Resolves to `$HOME/Movies`.
/// - **Windows:** Resolves to `{FOLDERID_Videos}`.
pub fn video_dir(&self) -> Result<PathBuf> {
dirs_next::video_dir().ok_or(Error::UnknownPath)
dirs::video_dir().ok_or(Error::UnknownPath)
}
/// Returns the path to the resource directory of this app.
@ -196,7 +196,7 @@ impl<R: Runtime> PathResolver<R> {
///
/// Resolves to [`config_dir`](self.config_dir)`/${bundle_identifier}`.
pub fn app_config_dir(&self) -> Result<PathBuf> {
dirs_next::config_dir()
dirs::config_dir()
.ok_or(Error::UnknownPath)
.map(|dir| dir.join(&self.0.config().identifier))
}
@ -205,7 +205,7 @@ impl<R: Runtime> PathResolver<R> {
///
/// Resolves to [`data_dir`](self.data_dir)`/${bundle_identifier}`.
pub fn app_data_dir(&self) -> Result<PathBuf> {
dirs_next::data_dir()
dirs::data_dir()
.ok_or(Error::UnknownPath)
.map(|dir| dir.join(&self.0.config().identifier))
}
@ -214,7 +214,7 @@ impl<R: Runtime> PathResolver<R> {
///
/// Resolves to [`local_data_dir`](self.local_data_dir)`/${bundle_identifier}`.
pub fn app_local_data_dir(&self) -> Result<PathBuf> {
dirs_next::data_local_dir()
dirs::data_local_dir()
.ok_or(Error::UnknownPath)
.map(|dir| dir.join(&self.0.config().identifier))
}
@ -223,7 +223,7 @@ impl<R: Runtime> PathResolver<R> {
///
/// Resolves to [`cache_dir`](self.cache_dir)`/${bundle_identifier}`.
pub fn app_cache_dir(&self) -> Result<PathBuf> {
dirs_next::cache_dir()
dirs::cache_dir()
.ok_or(Error::UnknownPath)
.map(|dir| dir.join(&self.0.config().identifier))
}
@ -237,12 +237,12 @@ impl<R: Runtime> PathResolver<R> {
/// - **Windows:** Resolves to [`data_local_dir`](self.data_local_dir)`/${bundle_identifier}/logs`.
pub fn app_log_dir(&self) -> Result<PathBuf> {
#[cfg(target_os = "macos")]
let path = dirs_next::home_dir()
let path = dirs::home_dir()
.ok_or(Error::UnknownPath)
.map(|dir| dir.join("Library/Logs").join(&self.0.config().identifier));
#[cfg(not(target_os = "macos"))]
let path = dirs_next::data_local_dir()
let path = dirs::data_local_dir()
.ok_or(Error::UnknownPath)
.map(|dir| dir.join(&self.0.config().identifier).join("logs"));

View File

@ -66,7 +66,7 @@ impl<'de> Deserialize<'de> for SafePathBuf {
/// The base directory is the optional root of a file system operation.
/// If informed by the API call, all paths will be relative to the path of the given directory.
///
/// For more information, check the [`dirs_next` documentation](https://docs.rs/dirs_next/).
/// For more information, check the [`dirs` documentation](https://docs.rs/dirs/).
#[derive(Serialize_repr, Deserialize_repr, Clone, Copy, Debug)]
#[repr(u16)]
#[non_exhaustive]

View File

@ -30,7 +30,7 @@ walkdir = "2"
handlebars = "5.1"
tempfile = "3.10.1"
log = { version = "0.4.21", features = [ "kv" ] }
dirs-next = "2.0"
dirs = "5"
os_pipe = "1"
ureq = { version = "2.9.6", default-features = false, features = [ "socks-proxy" ] }
native-tls = { version = "0.2", optional = true }

View File

@ -60,7 +60,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
sh_map.insert("app_name", settings.product_name());
sh_map.insert("app_name_uppercase", &upcase_app_name);
sh_map.insert("appimage_filename", &appimage_filename);
let tauri_tools_path = dirs_next::cache_dir().map_or_else(
let tauri_tools_path = dirs::cache_dir().map_or_else(
|| output_path.to_path_buf(),
|mut p| {
p.push("tauri");

View File

@ -407,7 +407,7 @@ fn copy_frameworks_to_bundle(
framework
)));
}
if let Some(home_dir) = dirs_next::home_dir() {
if let Some(home_dir) = dirs::home_dir() {
if copy_framework_from(&dest_dir, framework, &home_dir.join("Library/Frameworks/"))? {
continue;
}

View File

@ -424,7 +424,7 @@ pub fn notarize_auth() -> Result<NotarizeAuth, NotarizeAuthError> {
let mut key_path = None;
let mut search_paths = vec!["./private_keys".into()];
if let Some(home_dir) = dirs_next::home_dir() {
if let Some(home_dir) = dirs::home_dir() {
search_paths.push(home_dir.join("private_keys"));
search_paths.push(home_dir.join(".private_keys"));
search_paths.push(home_dir.join(".appstoreconnect").join("private_keys"));

View File

@ -25,7 +25,7 @@ const WIX_REQUIRED_FILES: &[&str] = &[
/// Runs all of the commands to build the MSI installer.
/// Returns a vector of PathBuf that shows where the MSI was created.
pub fn bundle_project(settings: &Settings, updater: bool) -> crate::Result<Vec<PathBuf>> {
let mut wix_path = dirs_next::cache_dir().unwrap();
let mut wix_path = dirs::cache_dir().unwrap();
wix_path.push("tauri/WixTools");
if !wix_path.exists() {

View File

@ -63,7 +63,7 @@ const NSIS_REQUIRED_FILES_HASH: &[(&str, &str, &str, HashAlgorithm)] = &[(
/// Runs all of the commands to build the NSIS installer.
/// Returns a vector of PathBuf that shows where the NSIS installer was created.
pub fn bundle_project(settings: &Settings, updater: bool) -> crate::Result<Vec<PathBuf>> {
let tauri_tools_path = dirs_next::cache_dir().unwrap().join("tauri");
let tauri_tools_path = dirs::cache_dir().unwrap().join("tauri");
let nsis_toolset_path = tauri_tools_path.join("NSIS");
if !nsis_toolset_path.exists() {
@ -176,7 +176,7 @@ fn build_nsis_app_installer(
#[cfg(not(target_os = "windows"))]
{
let mut dir = dirs_next::cache_dir().unwrap();
let mut dir = dirs::cache_dir().unwrap();
dir.extend(["tauri", "NSIS", "Plugins", "x86-unicode"]);
data.insert("additional_plugins_path", to_json(dir));
}

26
tooling/cli/Cargo.lock generated
View File

@ -1102,24 +1102,24 @@ dependencies = [
]
[[package]]
name = "dirs-next"
version = "2.0.0"
name = "dirs"
version = "5.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1"
checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225"
dependencies = [
"cfg-if",
"dirs-sys-next",
"dirs-sys",
]
[[package]]
name = "dirs-sys-next"
version = "0.1.2"
name = "dirs-sys"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c"
dependencies = [
"libc",
"option-ext",
"redox_users",
"winapi",
"windows-sys 0.48.0",
]
[[package]]
@ -3127,6 +3127,12 @@ dependencies = [
"vcpkg",
]
[[package]]
name = "option-ext"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
[[package]]
name = "ordered-float"
version = "2.10.1"
@ -4844,7 +4850,7 @@ dependencies = [
"anyhow",
"ar",
"bitness",
"dirs-next",
"dirs",
"dunce",
"flate2",
"glob",