mirror of
https://github.com/beerpiss/saekawa.git
synced 2024-12-18 02:05:52 +01:00
fix: properly clear out old config file before writing new one
This commit is contained in:
parent
c3f85c7397
commit
6b624dc264
@ -1,7 +1,7 @@
|
|||||||
mod defaults;
|
mod defaults;
|
||||||
mod migrate;
|
mod migrate;
|
||||||
|
|
||||||
use std::{collections::HashMap, path::PathBuf, str::FromStr};
|
use std::{collections::HashMap, fs::File, path::PathBuf, str::FromStr};
|
||||||
|
|
||||||
use log::{info, warn};
|
use log::{info, warn};
|
||||||
use migrate::OldSaekawaConfig;
|
use migrate::OldSaekawaConfig;
|
||||||
@ -76,6 +76,12 @@ impl SaekawaConfig {
|
|||||||
tachi: new_tachi_config,
|
tachi: new_tachi_config,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
{
|
||||||
|
// confy doesn't actually truncate the file??
|
||||||
|
if let Ok(f) = File::create("saekawa.toml") {
|
||||||
|
f.set_len(0).ok();
|
||||||
|
}
|
||||||
|
}
|
||||||
confy::store_path("saekawa.toml", new_config.clone()).context(ConfySnafu)?;
|
confy::store_path("saekawa.toml", new_config.clone()).context(ConfySnafu)?;
|
||||||
|
|
||||||
Ok(new_config)
|
Ok(new_config)
|
||||||
|
Loading…
Reference in New Issue
Block a user