Fix toggle encryption

Open the config file in write mode so the toggle encryption button is actually working
This commit is contained in:
ffauzan
2022-07-18 22:03:01 +07:00
committed by GitHub
parent 6434814d1d
commit 44b148f2a4

View File

@@ -138,7 +138,7 @@ pub fn write_file(path: String, contents: String) {
let path_buf = std::path::PathBuf::from(&path);
// Create file if it exists, otherwise just open and rewrite
let mut file = match fs::File::open(&path_buf) {
let mut file = match fs::File::options().write(true).truncate(true).open(&path_buf) {
Ok(file) => file,
Err(e) => {
println!("Failed to open file: {}", e);
@@ -162,4 +162,4 @@ pub fn write_file(path: String, contents: String) {
return;
}
}
}
}