* Revert "Replace `std::env::home_dir` with `dirs::home_dir` (#9077)"
This reverts commit 7e779327eb
.
* Restore some of the changes
* Update parity-common
This commit is contained in:
parent
3f53e0e8b1
commit
f2ea66fc05
46
Cargo.lock
generated
46
Cargo.lock
generated
@ -351,20 +351,10 @@ name = "dir"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"app_dirs 1.2.1 (git+https://github.com/paritytech/app-dirs-rs)",
|
||||
"dirs 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ethereum-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"journaldb 0.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "docopt"
|
||||
version = "0.8.3"
|
||||
@ -1173,7 +1163,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "hashdb"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/paritytech/parity-common#a72c34f82ff7ccc0f49827bb7f8c5d1fbff794bb"
|
||||
source = "git+https://github.com/paritytech/parity-common#5f05acd90cf173f2e1ce477665be2a40502fef42"
|
||||
dependencies = [
|
||||
"elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -1437,7 +1427,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "keccak-hash"
|
||||
version = "0.1.2"
|
||||
source = "git+https://github.com/paritytech/parity-common#a72c34f82ff7ccc0f49827bb7f8c5d1fbff794bb"
|
||||
source = "git+https://github.com/paritytech/parity-common#5f05acd90cf173f2e1ce477665be2a40502fef42"
|
||||
dependencies = [
|
||||
"ethereum-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tiny-keccak 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -1465,7 +1455,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "kvdb"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/paritytech/parity-common#a72c34f82ff7ccc0f49827bb7f8c5d1fbff794bb"
|
||||
source = "git+https://github.com/paritytech/parity-common#5f05acd90cf173f2e1ce477665be2a40502fef42"
|
||||
dependencies = [
|
||||
"elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parity-bytes 0.1.0 (git+https://github.com/paritytech/parity-common)",
|
||||
@ -1474,7 +1464,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "kvdb-memorydb"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/paritytech/parity-common#a72c34f82ff7ccc0f49827bb7f8c5d1fbff794bb"
|
||||
source = "git+https://github.com/paritytech/parity-common#5f05acd90cf173f2e1ce477665be2a40502fef42"
|
||||
dependencies = [
|
||||
"kvdb 0.1.0 (git+https://github.com/paritytech/parity-common)",
|
||||
"parking_lot 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -1483,7 +1473,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "kvdb-rocksdb"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/paritytech/parity-common#a72c34f82ff7ccc0f49827bb7f8c5d1fbff794bb"
|
||||
source = "git+https://github.com/paritytech/parity-common#5f05acd90cf173f2e1ce477665be2a40502fef42"
|
||||
dependencies = [
|
||||
"elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ethereum-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -1654,7 +1644,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
[[package]]
|
||||
name = "memorydb"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/paritytech/parity-common#a72c34f82ff7ccc0f49827bb7f8c5d1fbff794bb"
|
||||
source = "git+https://github.com/paritytech/parity-common#5f05acd90cf173f2e1ce477665be2a40502fef42"
|
||||
dependencies = [
|
||||
"elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hashdb 0.2.0 (git+https://github.com/paritytech/parity-common)",
|
||||
@ -1855,7 +1845,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"num-integer 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@ -1951,7 +1941,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "parity-bytes"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/paritytech/parity-common#a72c34f82ff7ccc0f49827bb7f8c5d1fbff794bb"
|
||||
source = "git+https://github.com/paritytech/parity-common#5f05acd90cf173f2e1ce477665be2a40502fef42"
|
||||
|
||||
[[package]]
|
||||
name = "parity-clib"
|
||||
@ -1963,7 +1953,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "parity-crypto"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/paritytech/parity-common#a72c34f82ff7ccc0f49827bb7f8c5d1fbff794bb"
|
||||
source = "git+https://github.com/paritytech/parity-common#5f05acd90cf173f2e1ce477665be2a40502fef42"
|
||||
dependencies = [
|
||||
"ethereum-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -2328,15 +2318,12 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "path"
|
||||
version = "0.1.1"
|
||||
source = "git+https://github.com/paritytech/parity-common#a72c34f82ff7ccc0f49827bb7f8c5d1fbff794bb"
|
||||
dependencies = [
|
||||
"dirs 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
source = "git+https://github.com/paritytech/parity-common#5f05acd90cf173f2e1ce477665be2a40502fef42"
|
||||
|
||||
[[package]]
|
||||
name = "patricia-trie"
|
||||
version = "0.2.1"
|
||||
source = "git+https://github.com/paritytech/parity-common#a72c34f82ff7ccc0f49827bb7f8c5d1fbff794bb"
|
||||
source = "git+https://github.com/paritytech/parity-common#5f05acd90cf173f2e1ce477665be2a40502fef42"
|
||||
dependencies = [
|
||||
"elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hashdb 0.2.0 (git+https://github.com/paritytech/parity-common)",
|
||||
@ -2411,7 +2398,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "plain_hasher"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/paritytech/parity-common#a72c34f82ff7ccc0f49827bb7f8c5d1fbff794bb"
|
||||
source = "git+https://github.com/paritytech/parity-common#5f05acd90cf173f2e1ce477665be2a40502fef42"
|
||||
dependencies = [
|
||||
"crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ethereum-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -2579,7 +2566,7 @@ dependencies = [
|
||||
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2647,7 +2634,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "rlp"
|
||||
version = "0.2.1"
|
||||
source = "git+https://github.com/paritytech/parity-common#a72c34f82ff7ccc0f49827bb7f8c5d1fbff794bb"
|
||||
source = "git+https://github.com/paritytech/parity-common#5f05acd90cf173f2e1ce477665be2a40502fef42"
|
||||
dependencies = [
|
||||
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -3324,7 +3311,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "trie-standardmap"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/paritytech/parity-common#a72c34f82ff7ccc0f49827bb7f8c5d1fbff794bb"
|
||||
source = "git+https://github.com/paritytech/parity-common#5f05acd90cf173f2e1ce477665be2a40502fef42"
|
||||
dependencies = [
|
||||
"ethereum-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"keccak-hash 0.1.2 (git+https://github.com/paritytech/parity-common)",
|
||||
@ -3335,7 +3322,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "triehash"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/paritytech/parity-common#a72c34f82ff7ccc0f49827bb7f8c5d1fbff794bb"
|
||||
source = "git+https://github.com/paritytech/parity-common#5f05acd90cf173f2e1ce477665be2a40502fef42"
|
||||
dependencies = [
|
||||
"elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ethereum-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -3668,7 +3655,6 @@ dependencies = [
|
||||
"checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9"
|
||||
"checksum daemonize 0.2.3 (git+https://github.com/paritytech/daemonize)" = "<none>"
|
||||
"checksum difference 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b3304d19798a8e067e48d8e69b2c37f0b5e9b4e462504ad9e27e9f3fce02bba8"
|
||||
"checksum dirs 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "37a76dd8b997af7107d0bb69d43903cf37153a18266f8b3fdb9911f28efb5444"
|
||||
"checksum docopt 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d8acd393692c503b168471874953a2531df0e9ab77d0b6bbc582395743300a4a"
|
||||
"checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab"
|
||||
"checksum edit-distance 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6a34f5204fbc13582de418611cf3a7dcdd07c6d312a5b631597ba72c06b9d9c9"
|
||||
|
@ -17,12 +17,13 @@
|
||||
//! Parity upgrade logic
|
||||
|
||||
use semver::{Version, SemVerError};
|
||||
use std::collections::HashMap;
|
||||
use std::collections::*;
|
||||
use std::fs::{self, File, create_dir_all};
|
||||
use std::env;
|
||||
use std::io;
|
||||
use std::io::{Read, Write};
|
||||
use std::path::{PathBuf, Path};
|
||||
use dir::{DatabaseDirectories, default_data_path, home_dir};
|
||||
use dir::{DatabaseDirectories, default_data_path};
|
||||
use dir::helpers::replace_home;
|
||||
use journaldb::Algorithm;
|
||||
|
||||
@ -105,7 +106,7 @@ fn with_locked_version<F>(db_path: Option<&str>, script: F) -> Result<usize, Err
|
||||
where F: Fn(&Version) -> Result<usize, Error>
|
||||
{
|
||||
let mut path = db_path.map_or({
|
||||
let mut path = home_dir().expect("Applications should have a home dir");
|
||||
let mut path = env::home_dir().expect("Applications should have a home dir");
|
||||
path.push(".parity");
|
||||
path
|
||||
}, PathBuf::from);
|
||||
|
@ -8,4 +8,3 @@ license = "GPL3"
|
||||
ethereum-types = "0.3"
|
||||
journaldb = { path = "../journaldb" }
|
||||
app_dirs = { git = "https://github.com/paritytech/app-dirs-rs" }
|
||||
dirs = "1.0.2"
|
||||
|
@ -15,11 +15,12 @@
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Directory helper functions
|
||||
use std::env;
|
||||
|
||||
/// Replaces `$HOME` str with home directory path.
|
||||
pub fn replace_home(base: &str, arg: &str) -> String {
|
||||
// the $HOME directory on mac os should be `~/Library` or `~/Library/Application Support`
|
||||
let r = arg.replace("$HOME", ::dirs::home_dir().unwrap().to_str().unwrap());
|
||||
let r = arg.replace("$HOME", env::home_dir().unwrap().to_str().unwrap());
|
||||
let r = r.replace("$BASE", base);
|
||||
r.replace("/", &::std::path::MAIN_SEPARATOR.to_string())
|
||||
}
|
||||
|
@ -18,12 +18,11 @@
|
||||
|
||||
//! Dir utilities for platform-specific operations
|
||||
extern crate app_dirs;
|
||||
extern crate dirs;
|
||||
extern crate ethereum_types;
|
||||
extern crate journaldb;
|
||||
|
||||
pub mod helpers;
|
||||
use std::fs;
|
||||
use std::{env, fs};
|
||||
use std::path::{PathBuf, Path};
|
||||
use ethereum_types::{H64, H256};
|
||||
use journaldb::Algorithm;
|
||||
@ -32,8 +31,6 @@ use app_dirs::{AppInfo, get_app_root, AppDataType};
|
||||
// re-export platform-specific functions
|
||||
use platform::*;
|
||||
|
||||
pub use dirs::home_dir;
|
||||
|
||||
/// Platform-specific chains path for standard client - Windows only
|
||||
#[cfg(target_os = "windows")] pub const CHAINS_PATH: &str = "$LOCAL/chains";
|
||||
/// Platform-specific chains path for light client - Windows only
|
||||
@ -240,7 +237,7 @@ pub fn default_hypervisor_path() -> PathBuf {
|
||||
|
||||
/// Get home directory.
|
||||
fn home() -> PathBuf {
|
||||
dirs::home_dir().expect("Failed to get home dir")
|
||||
env::home_dir().expect("Failed to get home dir")
|
||||
}
|
||||
|
||||
/// Geth path
|
||||
@ -263,9 +260,9 @@ pub fn parity(chain: &str) -> PathBuf {
|
||||
#[cfg(target_os = "macos")]
|
||||
mod platform {
|
||||
use std::path::PathBuf;
|
||||
pub const AUTHOR: &'static str = "Parity";
|
||||
pub const PRODUCT: &'static str = "io.parity.ethereum";
|
||||
pub const PRODUCT_HYPERVISOR: &'static str = "io.parity.ethereum-updates";
|
||||
pub const AUTHOR: &str = "Parity";
|
||||
pub const PRODUCT: &str = "io.parity.ethereum";
|
||||
pub const PRODUCT_HYPERVISOR: &str = "io.parity.ethereum-updates";
|
||||
|
||||
pub fn parity_base() -> PathBuf {
|
||||
let mut home = super::home();
|
||||
@ -287,9 +284,9 @@ mod platform {
|
||||
#[cfg(windows)]
|
||||
mod platform {
|
||||
use std::path::PathBuf;
|
||||
pub const AUTHOR: &'static str = "Parity";
|
||||
pub const PRODUCT: &'static str = "Ethereum";
|
||||
pub const PRODUCT_HYPERVISOR: &'static str = "EthereumUpdates";
|
||||
pub const AUTHOR: &str = "Parity";
|
||||
pub const PRODUCT: &str = "Ethereum";
|
||||
pub const PRODUCT_HYPERVISOR: &str = "EthereumUpdates";
|
||||
|
||||
pub fn parity_base() -> PathBuf {
|
||||
let mut home = super::home();
|
||||
|
Loading…
Reference in New Issue
Block a user