diff --git a/cmd/crates/soroban-test/tests/it/config.rs b/cmd/crates/soroban-test/tests/it/config.rs index ea925ca59..acd04c062 100644 --- a/cmd/crates/soroban-test/tests/it/config.rs +++ b/cmd/crates/soroban-test/tests/it/config.rs @@ -19,12 +19,11 @@ fn ls(sandbox: &TestEnv) -> Vec { .collect::>() } -pub const NETWORKS: &str = "\ -local +pub const NETWORKS: &str = r#"local futurenet mainnet testnet -"; +"#; #[test] fn set_and_remove_network() { diff --git a/cmd/soroban-cli/src/config/mod.rs b/cmd/soroban-cli/src/config/mod.rs index 1465ed4b4..499896437 100644 --- a/cmd/soroban-cli/src/config/mod.rs +++ b/cmd/soroban-cli/src/config/mod.rs @@ -195,12 +195,8 @@ impl Config { pub fn save(&self) -> Result<(), locator::Error> { let toml_string = toml::to_string(&self)?; let path = locator::config_file()?; - let parent = path.parent(); - if let Some(parent) = parent { - fs::create_dir_all(parent)?; - } // Depending on the platform, this function may fail if the full directory path does not exist - let mut file = File::create(path)?; + let mut file = File::create(locator::ensure_directory(path)?)?; file.write_all(toml_string.as_bytes())?; Ok(())