Switch to dirs-next

This commit is contained in:
Michael Vines
2020-10-31 09:09:17 -07:00
committed by mergify[bot]
parent 39120b3343
commit e872715fd6
10 changed files with 61 additions and 56 deletions

View File

@ -16,7 +16,7 @@ chrono = { version = "0.4.11", features = ["serde"] }
clap = { version = "2.33.1" }
console = "0.11.3"
ctrlc = { version = "3.1.5", features = ["termination"] }
dirs = "2.0.2"
dirs-next = "2.0.0"
indicatif = "0.15.0"
lazy_static = "1.4.0"
nix = "0.17.0"

View File

@ -425,19 +425,19 @@ fn add_to_path(new_path: &str) -> Result<bool, String> {
let mut modified_rcfiles = false;
// Look for sh, bash, and zsh rc files
let mut rcfiles = vec![dirs::home_dir().map(|p| p.join(".profile"))];
let mut rcfiles = vec![dirs_next::home_dir().map(|p| p.join(".profile"))];
if let Ok(shell) = std::env::var("SHELL") {
if shell.contains("zsh") {
let zdotdir = std::env::var("ZDOTDIR")
.ok()
.map(PathBuf::from)
.or_else(dirs::home_dir);
.or_else(dirs_next::home_dir);
let zprofile = zdotdir.map(|p| p.join(".zprofile"));
rcfiles.push(zprofile);
}
}
if let Some(bash_profile) = dirs::home_dir().map(|p| p.join(".bash_profile")) {
if let Some(bash_profile) = dirs_next::home_dir().map(|p| p.join(".bash_profile")) {
// Only update .bash_profile if it exists because creating .bash_profile
// will cause .profile to not be read
if bash_profile.exists() {

View File

@ -2,19 +2,19 @@ pub const JSON_RPC_URL: &str = "http://devnet.solana.com";
lazy_static! {
pub static ref CONFIG_FILE: Option<String> = {
dirs::home_dir().map(|mut path| {
dirs_next::home_dir().map(|mut path| {
path.extend(&[".config", "solana", "install", "config.yml"]);
path.to_str().unwrap().to_string()
})
};
pub static ref USER_KEYPAIR: Option<String> = {
dirs::home_dir().map(|mut path| {
dirs_next::home_dir().map(|mut path| {
path.extend(&[".config", "solana", "id.json"]);
path.to_str().unwrap().to_string()
})
};
pub static ref DATA_DIR: Option<String> = {
dirs::home_dir().map(|mut path| {
dirs_next::home_dir().map(|mut path| {
path.extend(&[".local", "share", "solana", "install"]);
path.to_str().unwrap().to_string()
})