Merge #405: fix not found settings file error for old gui versions.
3eeba082483c06318ca7a1f018ce2c5da47f5f32 fix not found settings file error for old gui versions. (edouard)
Pull request description:
After migrating from a 0.1 or 0.2 version of the gui user may want to update the keys aliases in the settings This commit makes sure that a settings file exists when wallet is loaded.
ACKs for top commit:
edouardparis:
Self-ACK 3eeba082483c06318ca7a1f018ce2c5da47f5f32
Tree-SHA512: f1bb7e04b9e71bf8d169410a5c701a5a027866353b648d9ed56fce9cde109c234a34a51c9d1f7ab4890902fbe781bcb9e6739f2d7b6a2875cf05b04e60b4ede5
This commit is contained in:
commit
dcc1e0eb3c
@ -47,6 +47,7 @@ impl Settings {
|
||||
|
||||
let mut settings_file = OpenOptions::new()
|
||||
.write(true)
|
||||
.create(true)
|
||||
.truncate(true)
|
||||
.open(path)
|
||||
.map_err(|e| SettingsError::WritingFile(e.to_string()))?;
|
||||
|
||||
@ -91,7 +91,16 @@ impl Wallet {
|
||||
self.with_hardware_wallets(gui_config_hws)
|
||||
}
|
||||
}
|
||||
Err(settings::SettingsError::NotFound) => self.with_hardware_wallets(gui_config_hws),
|
||||
Err(settings::SettingsError::NotFound) => {
|
||||
let wallet = self.with_hardware_wallets(gui_config_hws);
|
||||
let s = settings::Settings {
|
||||
wallets: vec![settings::WalletSetting::from(&wallet)],
|
||||
};
|
||||
|
||||
tracing::info!("Settings file not found, creating one");
|
||||
s.to_file(datadir_path.to_path_buf(), network)?;
|
||||
wallet
|
||||
}
|
||||
Err(e) => return Err(e.into()),
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user