diff options
author | GeckoEidechse <gecko.eidechse+git@pm.me> | 2022-09-10 00:26:40 +0200 |
---|---|---|
committer | GeckoEidechse <gecko.eidechse+git@pm.me> | 2022-09-10 00:26:40 +0200 |
commit | 149b0235433865d419f438025d60eb4885cf6258 (patch) | |
tree | c5427bbbfad90b91c0b76e44850c6cd91f8ae21c | |
parent | d2909a73fe58bae1b7cf41671bde1f9b95412ff3 (diff) | |
download | FlightCore-149b0235433865d419f438025d60eb4885cf6258.tar.gz FlightCore-149b0235433865d419f438025d60eb4885cf6258.zip |
Delete temp download folder after finished install
-rw-r--r-- | src-tauri/src/lib.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 178ae2d4..5eb19b5b 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -146,11 +146,11 @@ fn extract(zip_file: std::fs::File, target: &std::path::Path) -> Result<()> { ///Checks cache, else downloads the latest version async fn do_install(nmod: &thermite::model::Mod, game_path: &std::path::Path) -> Result<()> { let filename = format!("northstar-{}.zip", nmod.version); - let download_directory = format!("{}/flightcore-temp-download-dir/", game_path.display()); + let download_directory = format!("{}/___flightcore-temp-download-dir/", game_path.display()); std::fs::create_dir_all(download_directory.clone())?; - let download_path = format!("{}/{}", download_directory, filename); + let download_path = format!("{}/{}", download_directory.clone(), filename); println!("{}", download_path); let nfile = thermite::core::actions::download_file(&nmod.url, download_path) @@ -159,6 +159,11 @@ async fn do_install(nmod: &thermite::model::Mod, game_path: &std::path::Path) -> println!("Extracting Northstar..."); extract(nfile, game_path)?; + + // Delete old copy + println!("Delete temp folder again"); + std::fs::remove_dir_all(download_directory).unwrap(); + println!("Done!"); Ok(()) |