Skip to content

Commit

Permalink
chore(tauri) dirs crate is unmaintained, use dirst-next instead (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog authored Oct 18, 2020
1 parent a3b7247 commit 82cda98
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 22 deletions.
6 changes: 6 additions & 0 deletions .changes/dirs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"tauri-bundler": patch
"tauri-api": patch
---

`dirs` crate is unmaintained, now using `dirs-next` instead.
2 changes: 1 addition & 1 deletion cli/tauri-bundler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ edition = "2018"
ar = "0.8.0"
chrono = "0.4"
clap = "^2"
dirs = "2.0.2"
dirs-next = "1.0.2"
glob = "0.3.0"
icns = "0.3"
image = "0.23.10"
Expand Down
4 changes: 2 additions & 2 deletions cli/tauri-bundler/src/bundle/osx_bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use crate::Settings;

use anyhow::Context;
use chrono;
use dirs;
use dirs_next;
use icns;
use image::{self, GenericImageView};

Expand Down Expand Up @@ -316,7 +316,7 @@ fn copy_frameworks_to_bundle(bundle_directory: &Path, settings: &Settings) -> cr
framework
)));
}
if let Some(home_dir) = dirs::home_dir() {
if let Some(home_dir) = dirs_next::home_dir() {
if copy_framework_from(&dest_dir, framework, &home_dir.join("Library/Frameworks/"))? {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion tauri-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ exclude = [ "test/fixture/**" ]
serde = { version = "1.0", features = [ "derive" ] }
serde_json = "1.0"
serde_repr = "0.1"
dirs = "3.0.1"
dirs-next = "1.0.2"
zip = "0.5.8"
semver = "0.11"
tempfile = "3"
Expand Down
36 changes: 18 additions & 18 deletions tauri-api/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use serde_repr::{Deserialize_repr, Serialize_repr};
/// The base directory is the optional root of a FS 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 documentation](https://docs.rs/dirs/).
/// For more information, check the [dirs_next documentation](https://docs.rs/dirs_next/).
#[derive(Serialize_repr, Deserialize_repr, Clone, Debug)]
#[repr(u16)]
pub enum BaseDirectory {
Expand Down Expand Up @@ -95,82 +95,82 @@ pub fn resolve_path<P: AsRef<Path>>(path: P, dir: Option<BaseDirectory>) -> crat

/// Returns the path to the user's audio directory.
pub fn audio_dir() -> Option<PathBuf> {
dirs::audio_dir()
dirs_next::audio_dir()
}

/// Returns the path to the user's cache directory.
pub fn cache_dir() -> Option<PathBuf> {
dirs::cache_dir()
dirs_next::cache_dir()
}

/// Returns the path to the user's config directory.
pub fn config_dir() -> Option<PathBuf> {
dirs::config_dir()
dirs_next::config_dir()
}

/// Returns the path to the user's data directory.
pub fn data_dir() -> Option<PathBuf> {
dirs::data_dir()
dirs_next::data_dir()
}

/// Returns the path to the user's local data directory.
pub fn local_data_dir() -> Option<PathBuf> {
dirs::data_local_dir()
dirs_next::data_local_dir()
}

/// Returns the path to the user's desktop directory.
pub fn desktop_dir() -> Option<PathBuf> {
dirs::desktop_dir()
dirs_next::desktop_dir()
}

/// Returns the path to the user's document directory.
pub fn document_dir() -> Option<PathBuf> {
dirs::document_dir()
dirs_next::document_dir()
}

/// Returns the path to the user's download directory.
pub fn download_dir() -> Option<PathBuf> {
dirs::download_dir()
dirs_next::download_dir()
}

/// Returns the path to the user's executable directory.
pub fn executable_dir() -> Option<PathBuf> {
dirs::executable_dir()
dirs_next::executable_dir()
}

/// Returns the path to the user's font directory.
pub fn font_dir() -> Option<PathBuf> {
dirs::font_dir()
dirs_next::font_dir()
}

/// Returns the path to the user's home directory.
pub fn home_dir() -> Option<PathBuf> {
dirs::home_dir()
dirs_next::home_dir()
}

/// Returns the path to the user's picture directory.
pub fn picture_dir() -> Option<PathBuf> {
dirs::picture_dir()
dirs_next::picture_dir()
}

/// Returns the path to the user's public directory.
pub fn public_dir() -> Option<PathBuf> {
dirs::public_dir()
dirs_next::public_dir()
}

/// Returns the path to the user's runtime directory.
pub fn runtime_dir() -> Option<PathBuf> {
dirs::runtime_dir()
dirs_next::runtime_dir()
}

/// Returns the path to the user's template directory.
pub fn template_dir() -> Option<PathBuf> {
dirs::template_dir()
dirs_next::template_dir()
}

/// Returns the path to the user's video dir
pub fn video_dir() -> Option<PathBuf> {
dirs::video_dir()
dirs_next::video_dir()
}

/// Returns the path to the resource directory of this app.
Expand All @@ -190,7 +190,7 @@ fn app_name() -> crate::Result<String> {

/// Returns the path to the suggested directory for your app config files.
pub fn app_dir() -> Option<PathBuf> {
dirs::config_dir().and_then(|mut dir| {
dirs_next::config_dir().and_then(|mut dir| {
if let Ok(app_name) = app_name() {
dir.push(app_name);
Some(dir)
Expand Down

0 comments on commit 82cda98

Please sign in to comment.