Skip to content

Commit

Permalink
Replace app_dirs with app_dirs2.
Browse files Browse the repository at this point in the history
  • Loading branch information
crlf0710 committed Oct 3, 2019
1 parent 3cdd3a5 commit cc0487d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 36 deletions.
32 changes: 5 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ name = "tectonic"
crate-type = ["rlib"]

[dependencies]
app_dirs = "^1.1"
app_dirs2 = "^2"
structopt = "0.3"
error-chain = "^0.12"
flate2 = { version = "^1.0", default-features = false, features = ["zlib"] }
Expand Down
12 changes: 6 additions & 6 deletions src/app_dirs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
// Licensed under the MIT License.

use crate::errors::Result;
use app_dirs::AppDataType;
use app_dirs2::AppDataType;
use std::path::PathBuf;

pub use app_dirs::sanitized;
pub use app_dirs2::sanitized;

const APP_INFO: app_dirs::AppInfo = app_dirs::AppInfo {
const APP_INFO: app_dirs2::AppInfo = app_dirs2::AppInfo {
name: "Tectonic",
author: "TectonicProject",
};

pub fn user_config() -> Result<PathBuf> {
Ok(app_dirs::app_root(AppDataType::UserConfig, &APP_INFO)?)
Ok(app_dirs2::app_root(AppDataType::UserConfig, &APP_INFO)?)
}

pub fn get_user_config() -> Result<PathBuf> {
Ok(app_dirs::get_app_root(AppDataType::UserConfig, &APP_INFO)?)
Ok(app_dirs2::get_app_root(AppDataType::UserConfig, &APP_INFO)?)
}

pub fn user_cache_dir(path: &str) -> Result<PathBuf> {
Ok(app_dirs::app_dir(AppDataType::UserCache, &APP_INFO, path)?)
Ok(app_dirs2::app_dir(AppDataType::UserCache, &APP_INFO, path)?)
}
3 changes: 1 addition & 2 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
// hopefully show up in a future version.
#![allow(deprecated)]

use app_dirs;
use error_chain::error_chain;
use reqwest::StatusCode;
use std::io::Write;
Expand All @@ -27,7 +26,7 @@ error_chain! {
}

foreign_links {
AppDirs(app_dirs::AppDirsError);
AppDirs(app_dirs2::AppDirsError);
Io(io::Error);
Nul(ffi::NulError);
ParseInt(num::ParseIntError);
Expand Down

0 comments on commit cc0487d

Please sign in to comment.