Fix --geth IPC for MacOS. (#1062)

This commit is contained in:
Gav Wood 2016-05-09 12:04:00 +01:00
parent 49cc40708d
commit 2a19f91e99

View File

@ -267,10 +267,18 @@ impl Configuration {
self.args.flag_jsonrpc_cors.clone().or(self.args.flag_rpccorsdomain.clone()) self.args.flag_jsonrpc_cors.clone().or(self.args.flag_rpccorsdomain.clone())
} }
fn geth_ipc_path() -> &'static str {
if cfg!(target_os = "macos") {
"$HOME/Library/Ethereum/geth.ipc"
} else {
"$HOME/.ethereum/geth.ipc"
}
}
pub fn ipc_settings(&self) -> IpcConfiguration { pub fn ipc_settings(&self) -> IpcConfiguration {
IpcConfiguration { IpcConfiguration {
enabled: !(self.args.flag_ipcdisable || self.args.flag_ipc_off), enabled: !(self.args.flag_ipcdisable || self.args.flag_ipc_off),
socket_addr: if self.args.flag_geth { "$HOME/.ethereum/geth.ipc".to_owned() } else { self.args.flag_ipcpath.clone().unwrap_or(self.args.flag_ipc_path.clone()) } socket_addr: if self.args.flag_geth { Self::geth_ipc_path().to_owned() } else { self.args.flag_ipcpath.clone().unwrap_or(self.args.flag_ipc_path.clone()) }
.replace("$HOME", env::home_dir().unwrap().to_str().unwrap()), .replace("$HOME", env::home_dir().unwrap().to_str().unwrap()),
apis: self.args.flag_ipcapi.clone().unwrap_or(self.args.flag_ipc_apis.clone()), apis: self.args.flag_ipcapi.clone().unwrap_or(self.args.flag_ipc_apis.clone()),
} }