Second attempt to fix double path generation bug present in the original grin-wallet code, probably by an inherent bug in fs::create_dir_all

This commit is contained in:
Anynomouss
2025-04-04 15:32:23 +02:00
parent 21188555c6
commit 004c46958b
+7 -8
View File
@@ -114,13 +114,6 @@ where
let mut config_file_name = PathBuf::from(self.data_dir.clone());
config_file_name.push(file_name);
// create top level dir if it doesn't exist
let dd = PathBuf::from(self.data_dir.clone());
if !dd.exists() {
// try create
fs::create_dir_all(dd)?;
}
let mut data_dir_name = PathBuf::from(self.data_dir.clone());
data_dir_name.push(GRIN_WALLET_DIR);
@@ -145,7 +138,13 @@ where
// if no config provided, update defaults
if update == true {
default_config.update_paths(&abs_path_node, &absolute_path_wallet);
// create top level dir if it doesn't exist
let dd = PathBuf::from(self.data_dir.clone());
if !dd.exists() {
// try create
fs::create_dir_all(dd)?;
default_config.update_paths(&abs_path_node, &absolute_path_wallet);
}
};
let res =
default_config.write_to_file(config_file_name.to_str().unwrap(), false, None, None);