From f9ac24d1f229a9de07ae3f0f53cde69682772fdc Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Sat, 31 Oct 2020 09:09:17 -0700 Subject: [PATCH] Switch to dirs-next --- Cargo.lock | 81 +++++++++++++++++++++------------------- cli-config/Cargo.toml | 2 +- cli-config/src/config.rs | 4 +- cli/Cargo.toml | 2 +- install/Cargo.toml | 2 +- install/src/command.rs | 6 +-- install/src/defaults.rs | 6 +-- keygen/Cargo.toml | 2 +- keygen/src/keygen.rs | 6 +-- tokens/Cargo.toml | 2 +- 10 files changed, 59 insertions(+), 54 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dc1bd63be7..4e716ec27b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -173,7 +173,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0df2f85c8a2abbe3b7d7e748052fdd9b76a0458fdeb16ad4223f5eca78c7c130" dependencies = [ "addr2line", - "cfg-if", + "cfg-if 0.1.10", "libc", "object", "rustc-demangle", @@ -247,7 +247,7 @@ checksum = "c72a978d268b1d70b0e963217e60fdabd9523a941457a6c42a7315d15c7e89e5" dependencies = [ "bitflags", "cexpr", - "cfg-if", + "cfg-if 0.1.10", "clang-sys", "clap", "env_logger", @@ -289,7 +289,7 @@ dependencies = [ "arrayref", "arrayvec", "cc", - "cfg-if", + "cfg-if 0.1.10", "constant_time_eq", "crypto-mac 0.8.0", "digest 0.9.0", @@ -471,6 +471,12 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + [[package]] name = "chrono" version = "0.4.11" @@ -585,7 +591,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", ] [[package]] @@ -629,7 +635,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" dependencies = [ "autocfg 1.0.0", - "cfg-if", + "cfg-if 0.1.10", "crossbeam-utils", "lazy_static", "maybe-uninit", @@ -643,7 +649,7 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "crossbeam-utils", "maybe-uninit", ] @@ -655,7 +661,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" dependencies = [ "autocfg 1.0.0", - "cfg-if", + "cfg-if 0.1.10", "lazy_static", ] @@ -786,22 +792,21 @@ dependencies = [ ] [[package]] -name = "dirs" -version = "2.0.2" +name = "dirs-next" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" dependencies = [ - "cfg-if", - "dirs-sys", + "cfg-if 1.0.0", + "dirs-sys-next", ] [[package]] -name = "dirs-sys" -version = "0.3.4" +name = "dirs-sys-next" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afa0b23de8fd801745c471deffa6e12d248f962c9fd4b4c33787b055599bde7b" +checksum = "99de365f605554ae33f115102a02057d4fc18b01f3284d6870be0938743cfe7d" dependencies = [ - "cfg-if", "libc", "redox_users", "winapi 0.3.8", @@ -890,7 +895,7 @@ version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8ac63f94732332f44fe654443c46f6375d1939684c17b0afb6cb56b0456e171" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", ] [[package]] @@ -975,7 +980,7 @@ version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "affc17579b132fc2461adf7c575cc6e8b134ebca52c51f5411388965227dc695" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "libc", "redox_syscall", "winapi 0.3.8", @@ -987,7 +992,7 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2cfff41391129e0a856d6d822600b8d71179d46879e310417eb9c762eb178b42" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "crc32fast", "libc", "miniz_oxide", @@ -1199,7 +1204,7 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "libc", "wasi", ] @@ -1931,7 +1936,7 @@ version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", ] [[package]] @@ -2029,7 +2034,7 @@ version = "0.6.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "fuchsia-zircon", "fuchsia-zircon-sys", "iovec", @@ -2123,7 +2128,7 @@ version = "0.2.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "libc", "winapi 0.3.8", ] @@ -2136,7 +2141,7 @@ checksum = "50e4785f2c3b7589a0d0c1dd60285e1188adac4006e8abd6dd578e1567027363" dependencies = [ "bitflags", "cc", - "cfg-if", + "cfg-if 0.1.10", "libc", "void", ] @@ -2273,7 +2278,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cee6d85f4cb4c4f59a6a85d5b68a233d280c82e29e822913b9c8b129fbf20bdd" dependencies = [ "bitflags", - "cfg-if", + "cfg-if 0.1.10", "foreign-types", "lazy_static", "libc", @@ -2344,7 +2349,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "cloudabi", "libc", "redox_syscall", @@ -2359,7 +2364,7 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "cloudabi", "libc", "redox_syscall", @@ -3380,7 +3385,7 @@ version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "libc", "redox_syscall", "winapi 0.3.8", @@ -3610,7 +3615,7 @@ dependencies = [ "console", "criterion-stats", "ctrlc", - "dirs", + "dirs-next", "humantime 2.0.1", "indicatif", "log 0.4.8", @@ -3651,7 +3656,7 @@ dependencies = [ name = "solana-cli-config" version = "1.3.20" dependencies = [ - "dirs", + "dirs-next", "lazy_static", "serde", "serde_derive", @@ -3976,7 +3981,7 @@ dependencies = [ "clap", "console", "ctrlc", - "dirs", + "dirs-next", "indicatif", "lazy_static", "nix", @@ -4004,7 +4009,7 @@ version = "1.3.20" dependencies = [ "bs58", "clap", - "dirs", + "dirs-next", "num_cpus", "solana-clap-utils", "solana-cli-config", @@ -4681,7 +4686,7 @@ dependencies = [ "clap", "console", "csv", - "dirs", + "dirs-next", "indexmap", "indicatif", "pickledb", @@ -5091,7 +5096,7 @@ version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "libc", "rand 0.7.3", "redox_syscall", @@ -5187,7 +5192,7 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a51cadc5b1eec673a685ff7c33192ff7b7603d0b75446fb354939ee615acb15" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "libc", "standback", "stdweb", @@ -5774,7 +5779,7 @@ version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0aae59226cf195d8e74d4b34beae1859257efb4e5fed3f147d2dc2c7d372178" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "log 0.4.8", "tracing-attributes", "tracing-core", @@ -6071,7 +6076,7 @@ version = "0.2.63" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c2dc4aa152834bc334f506c1a06b866416a8b6697d5c9f75b9a689c8486def0" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "serde", "serde_json", "wasm-bindgen-macro", @@ -6098,7 +6103,7 @@ version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64487204d863f109eb77e8462189d111f27cb5712cc9fdb3461297a76963a2f6" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "js-sys", "wasm-bindgen", "web-sys", diff --git a/cli-config/Cargo.toml b/cli-config/Cargo.toml index 7e89c4a348..fe1f08cf9d 100644 --- a/cli-config/Cargo.toml +++ b/cli-config/Cargo.toml @@ -9,7 +9,7 @@ license = "Apache-2.0" homepage = "https://solana.com/" [dependencies] -dirs = "2.0.2" +dirs-next = "2.0.0" lazy_static = "1.4.0" serde = "1.0.112" serde_derive = "1.0.103" diff --git a/cli-config/src/config.rs b/cli-config/src/config.rs index b3b2823928..fd2fe6be7c 100644 --- a/cli-config/src/config.rs +++ b/cli-config/src/config.rs @@ -5,7 +5,7 @@ use url::Url; lazy_static! { pub static ref CONFIG_FILE: Option = { - dirs::home_dir().map(|mut path| { + dirs_next::home_dir().map(|mut path| { path.extend(&[".config", "solana", "cli", "config.yml"]); path.to_str().unwrap().to_string() }) @@ -25,7 +25,7 @@ pub struct Config { impl Default for Config { fn default() -> Self { let keypair_path = { - let mut keypair_path = dirs::home_dir().expect("home directory"); + let mut keypair_path = dirs_next::home_dir().expect("home directory"); keypair_path.extend(&[".config", "solana", "id.json"]); keypair_path.to_str().unwrap().to_string() }; diff --git a/cli/Cargo.toml b/cli/Cargo.toml index ba69b1ed5f..ea7278ec65 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -16,7 +16,7 @@ clap = "2.33.1" criterion-stats = "0.3.0" ctrlc = { version = "3.1.5", features = ["termination"] } console = "0.11.3" -dirs = "2.0.2" +dirs-next = "2.0.0" log = "0.4.8" Inflector = "0.11.4" indicatif = "0.15.0" diff --git a/install/Cargo.toml b/install/Cargo.toml index ed6c2cbaad..6ff26c6aae 100644 --- a/install/Cargo.toml +++ b/install/Cargo.toml @@ -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" diff --git a/install/src/command.rs b/install/src/command.rs index 12ead45943..390cf9e3f0 100644 --- a/install/src/command.rs +++ b/install/src/command.rs @@ -425,19 +425,19 @@ fn add_to_path(new_path: &str) -> Result { 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() { diff --git a/install/src/defaults.rs b/install/src/defaults.rs index f078d8e09c..f0d5e53f5b 100644 --- a/install/src/defaults.rs +++ b/install/src/defaults.rs @@ -2,19 +2,19 @@ pub const JSON_RPC_URL: &str = "http://devnet.solana.com"; lazy_static! { pub static ref CONFIG_FILE: Option = { - 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 = { - 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 = { - 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() }) diff --git a/keygen/Cargo.toml b/keygen/Cargo.toml index 538274a627..57480548a2 100644 --- a/keygen/Cargo.toml +++ b/keygen/Cargo.toml @@ -11,7 +11,7 @@ edition = "2018" [dependencies] bs58 = "0.3.1" clap = "2.33" -dirs = "2.0.2" +dirs-next = "2.0.0" num_cpus = "1.13.0" solana-clap-utils = { path = "../clap-utils", version = "1.3.20" } solana-cli-config = { path = "../cli-config", version = "1.3.20" } diff --git a/keygen/src/keygen.rs b/keygen/src/keygen.rs index e3448b1876..49edc8562c 100644 --- a/keygen/src/keygen.rs +++ b/keygen/src/keygen.rs @@ -52,7 +52,7 @@ fn get_keypair_from_matches( config: Config, wallet_manager: &mut Option>, ) -> Result, Box> { - let mut path = dirs::home_dir().expect("home directory"); + let mut path = dirs_next::home_dir().expect("home directory"); let path = if matches.is_present("keypair") { matches.value_of("keypair").unwrap() } else if config.keypair_path != "" { @@ -421,7 +421,7 @@ fn do_main(matches: &ArgMatches<'_>) -> Result<(), Box> { } } ("new", Some(matches)) => { - let mut path = dirs::home_dir().expect("home directory"); + let mut path = dirs_next::home_dir().expect("home directory"); let outfile = if matches.is_present("outfile") { matches.value_of("outfile") } else if matches.is_present("no_outfile") { @@ -478,7 +478,7 @@ fn do_main(matches: &ArgMatches<'_>) -> Result<(), Box> { } } ("recover", Some(matches)) => { - let mut path = dirs::home_dir().expect("home directory"); + let mut path = dirs_next::home_dir().expect("home directory"); let outfile = if matches.is_present("outfile") { matches.value_of("outfile").unwrap() } else { diff --git a/tokens/Cargo.toml b/tokens/Cargo.toml index a21295b838..334f94b450 100644 --- a/tokens/Cargo.toml +++ b/tokens/Cargo.toml @@ -13,7 +13,7 @@ chrono = { version = "0.4", features = ["serde"] } clap = "2.33.0" console = "0.11.3" csv = "1.1.3" -dirs = "2.0.2" +dirs-next = "2.0.0" indexmap = "1.4.0" indicatif = "0.15.0" pickledb = "0.4.1"