mirror of
https://github.com/chatmail/core.git
synced 2026-04-26 01:46:34 +03:00
Save modified .toml if absolute paths were replaced with relative
Previously this required adding or removing an account.
This commit is contained in:
@@ -367,13 +367,20 @@ impl Config {
|
||||
|
||||
// Previous versions of the core stored absolute paths in account config.
|
||||
// Convert them to relative paths.
|
||||
let mut modified = false;
|
||||
for account in &mut inner.accounts {
|
||||
if let Ok(new_dir) = account.dir.strip_prefix(dir) {
|
||||
account.dir = new_dir.to_path_buf();
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(Config { file, inner })
|
||||
let config = Self { file, inner };
|
||||
if modified {
|
||||
config.sync().await?;
|
||||
}
|
||||
|
||||
Ok(config)
|
||||
}
|
||||
|
||||
/// Loads all accounts defined in the configuration file.
|
||||
|
||||
Reference in New Issue
Block a user