Add the ability to have the config file in $XDG_CONFIG_HOME/topgrade/topgrade.toml (#418)
This commit is contained in:
@@ -353,8 +353,15 @@ impl ConfigFile {
|
||||
let config_directory = config_directory();
|
||||
|
||||
let config_path = config_directory.join("topgrade.toml");
|
||||
let alt_config_path = config_directory.join("topgrade/topgrade.toml");
|
||||
|
||||
if !config_path.exists() {
|
||||
if config_path.exists() {
|
||||
debug!("Configuration at {}", config_path.display());
|
||||
Ok(config_path)
|
||||
} else if alt_config_path.exists() {
|
||||
debug!("Configuration at {}", alt_config_path.display());
|
||||
Ok(alt_config_path)
|
||||
} else {
|
||||
debug!("No configuration exists");
|
||||
write(&config_path, EXAMPLE_CONFIG).map_err(|e| {
|
||||
debug!(
|
||||
@@ -364,12 +371,9 @@ impl ConfigFile {
|
||||
);
|
||||
e
|
||||
})?;
|
||||
} else {
|
||||
debug!("Configuration at {}", config_path.display());
|
||||
}
|
||||
|
||||
Ok(config_path)
|
||||
}
|
||||
}
|
||||
|
||||
/// Read the configuration file.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user