mirror of
https://github.com/jwinterm/grin-wallet.git
synced 2026-10-17 07:11:36 +02:00
Additional fix for double path generation bug present in the original grin-wallet code, test on Linux if it works
This commit is contained in:
@@ -49,23 +49,23 @@ pub fn get_wallet_path(
|
|||||||
create_path: bool,
|
create_path: bool,
|
||||||
) -> Result<PathBuf, ConfigError> {
|
) -> Result<PathBuf, ConfigError> {
|
||||||
// Check if grin dir exists
|
// Check if grin dir exists
|
||||||
let mut grin_path = match dirs::home_dir() {
|
let mut wallet_path = match dirs::home_dir() {
|
||||||
Some(p) => p,
|
Some(p) => p,
|
||||||
None => PathBuf::new(),
|
None => PathBuf::new(),
|
||||||
};
|
};
|
||||||
grin_path.push(GRIN_HOME);
|
wallet_path.push(GRIN_HOME);
|
||||||
grin_path.push(chain_type.shortname());
|
wallet_path.push(chain_type.shortname());
|
||||||
// Create if the default path doesn't exist
|
// Create if the default path doesn't exist
|
||||||
if !grin_path.exists() && create_path {
|
if !wallet_path.exists() && create_path {
|
||||||
fs::create_dir_all(grin_path.clone())?;
|
fs::create_dir_all(wallet_path.clone())?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if !grin_path.exists() {
|
if !wallet_path.exists() {
|
||||||
Err(ConfigError::PathNotFoundError(String::from(
|
Err(ConfigError::PathNotFoundError(String::from(
|
||||||
grin_path.to_str().unwrap(),
|
wallet_path.to_str().unwrap(),
|
||||||
)))
|
)))
|
||||||
} else {
|
} else {
|
||||||
Ok(grin_path)
|
Ok(wallet_path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ where
|
|||||||
return Err(Error::Lifecycle(msg));
|
return Err(Error::Lifecycle(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
// If config exists but the datadir not yet exists, create data dir return ok
|
// If config exists but the datadir return ok
|
||||||
if config_file_name.exists() {
|
if config_file_name.exists() {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user