Skip to content

Commit d3a8e4f

Browse files
committed
fix: script is now deleted before trying to replace it.
1 parent dead2f6 commit d3a8e4f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src-tauri/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,10 @@ fn save_blob(app: tauri::AppHandle, path: String, data: Vec<u8>) -> Result<(), S
382382
.join("Scripts")
383383
.join(path);
384384

385+
if final_path.exists() {
386+
std::fs::remove_file(&final_path).map_err(|e| e.to_string())?;
387+
}
388+
385389
let mut file = File::create(&final_path).map_err(|e| e.to_string())?;
386390
file.write_all(&data).map_err(|e| e.to_string())?;
387391
drop(file);

0 commit comments

Comments
 (0)