Revert "fix conflict"

This reverts commit 1588bee5a3, reversing
changes made to 75b79d0202.
This commit is contained in:
ffauzan
2022-07-19 11:47:38 +07:00
parent 1588bee5a3
commit 656fa2cfe3

View File

@@ -138,11 +138,19 @@ 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::create(&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);
return;
// attempt to create file. otherwise return
match fs::File::create(&path_buf) {
Ok(file) => file,
Err(e) => {
println!("Failed to create file: {}", e);
return;
}
}
}
};