mirror of
https://github.com/ynqa/jnv.git
synced 2026-01-05 18:59:30 -06:00
fix: error when default config file already exists
This commit is contained in:
@@ -144,6 +144,10 @@ impl Args {
|
||||
let config_path = shellexpand::tilde(&self.config_file).into_owned();
|
||||
let path = PathBuf::from(config_path);
|
||||
|
||||
if path.exists() {
|
||||
return Err(anyhow!("Config file `{}` already exists", path.display()));
|
||||
}
|
||||
|
||||
if let Some(parent) = path.parent() {
|
||||
std::fs::create_dir_all(parent)?;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user