fixed path for testnet config (#1231)

This commit is contained in:
Nikolay Volf 2016-06-07 19:14:03 +04:00 committed by Gav Wood
parent ef39eed12f
commit e6d141e14f
2 changed files with 13 additions and 3 deletions

View File

@ -285,8 +285,10 @@ impl Configuration {
cors.map_or_else(Vec::new, |c| c.split(',').map(|s| s.to_owned()).collect()) cors.map_or_else(Vec::new, |c| c.split(',').map(|s| s.to_owned()).collect())
} }
fn geth_ipc_path() -> String { fn geth_ipc_path(&self) -> String {
path::ethereum::with_default("geth.ipc").to_str().unwrap().to_owned() if self.args.flag_testnet { path::ethereum::with_testnet("geth.ipc") }
else { path::ethereum::with_default("geth.ipc") }
.to_str().unwrap().to_owned()
} }
pub fn keys_iterations(&self) -> u32 { pub fn keys_iterations(&self) -> u32 {
@ -350,7 +352,7 @@ impl Configuration {
} }
fn ipc_path(&self) -> String { fn ipc_path(&self) -> String {
if self.args.flag_geth { Self::geth_ipc_path() } if self.args.flag_geth { self.geth_ipc_path() }
else { Configuration::replace_home(&self.args.flag_ipcpath.clone().unwrap_or(self.args.flag_ipc_path.clone())) } else { Configuration::replace_home(&self.args.flag_ipcpath.clone().unwrap_or(self.args.flag_ipc_path.clone())) }
} }
} }

View File

@ -53,4 +53,12 @@ pub mod ethereum {
pth.push(s); pth.push(s);
pth pth
} }
/// Get the specific folder inside default ethereum installation configured for testnet
pub fn with_testnet(s: &str) -> PathBuf {
let mut pth = default();
pth.push("testnet");
pth.push(s);
pth
}
} }