move helper functions to platform module
This commit is contained in:
parent
2e12a2db50
commit
268e8f5a64
@ -245,7 +245,7 @@ fn home() -> PathBuf {
|
||||
|
||||
/// Geth path
|
||||
pub fn geth(testnet: bool) -> PathBuf {
|
||||
let mut base = geth_base();
|
||||
let mut base = platform::geth_base();
|
||||
if testnet {
|
||||
base.push("testnet");
|
||||
}
|
||||
@ -255,14 +255,16 @@ pub fn geth(testnet: bool) -> PathBuf {
|
||||
|
||||
/// Parity path for specific chain
|
||||
pub fn parity(chain: &str) -> PathBuf {
|
||||
let mut base = parity_base();
|
||||
let mut base = platform::parity_base();
|
||||
base.push(chain);
|
||||
base
|
||||
}
|
||||
|
||||
mod platform {
|
||||
use std::path::PathBuf;
|
||||
#[cfg(target_os = "macos")]
|
||||
fn parity_base() -> PathBuf {
|
||||
let mut home = home();
|
||||
pub fn parity_base() -> PathBuf {
|
||||
let mut home = super::home();
|
||||
home.push("Library");
|
||||
home.push("Application Support");
|
||||
home.push("io.parity.ethereum");
|
||||
@ -271,8 +273,8 @@ fn parity_base() -> PathBuf {
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
fn parity_base() -> PathBuf {
|
||||
let mut home = home();
|
||||
pub fn parity_base() -> PathBuf {
|
||||
let mut home = super::home();
|
||||
home.push("AppData");
|
||||
home.push("Roaming");
|
||||
home.push("Parity");
|
||||
@ -282,8 +284,8 @@ fn parity_base() -> PathBuf {
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_os = "macos", windows)))]
|
||||
fn parity_base() -> PathBuf {
|
||||
let mut home = home();
|
||||
pub fn parity_base() -> PathBuf {
|
||||
let mut home = super::home();
|
||||
home.push(".local");
|
||||
home.push("share");
|
||||
home.push("io.parity.ethereum");
|
||||
@ -292,16 +294,16 @@ fn parity_base() -> PathBuf {
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
fn geth_base() -> PathBuf {
|
||||
let mut home = home();
|
||||
pub fn geth_base() -> PathBuf {
|
||||
let mut home = super::home();
|
||||
home.push("Library");
|
||||
home.push("Ethereum");
|
||||
home
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
fn geth_base() -> PathBuf {
|
||||
let mut home = home();
|
||||
pub fn geth_base() -> PathBuf {
|
||||
let mut home = super::home();
|
||||
home.push("AppData");
|
||||
home.push("Roaming");
|
||||
home.push("Ethereum");
|
||||
@ -309,11 +311,13 @@ fn geth_base() -> PathBuf {
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_os = "macos", windows)))]
|
||||
fn geth_base() -> PathBuf {
|
||||
let mut home = home();
|
||||
pub fn geth_base() -> PathBuf {
|
||||
let mut home = super::home();
|
||||
home.push(".ethereum");
|
||||
home
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::Directories;
|
||||
|
Loading…
Reference in New Issue
Block a user