mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-03-03 09:57:31 +00:00
Update file_helpers.rs
This commit is contained in:
parent
44b148f2a4
commit
c7954d2294
@ -138,19 +138,11 @@ 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::options().write(true).truncate(true).open(&path_buf) {
|
||||
let mut file = match fs::File::create(&path_buf) {
|
||||
Ok(file) => file,
|
||||
Err(e) => {
|
||||
println!("Failed to open file: {}", e);
|
||||
|
||||
// attempt to create file. otherwise return
|
||||
match fs::File::create(&path_buf) {
|
||||
Ok(file) => file,
|
||||
Err(e) => {
|
||||
println!("Failed to create file: {}", e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user