aboutsummaryrefslogtreecommitdiff
path: root/src-tauri/src/lib.rs
diff options
context:
space:
mode:
authorGeckoEidechse <gecko.eidechse+git@pm.me>2022-09-10 00:26:40 +0200
committerGeckoEidechse <gecko.eidechse+git@pm.me>2022-09-10 00:26:40 +0200
commit149b0235433865d419f438025d60eb4885cf6258 (patch)
treec5427bbbfad90b91c0b76e44850c6cd91f8ae21c /src-tauri/src/lib.rs
parentd2909a73fe58bae1b7cf41671bde1f9b95412ff3 (diff)
downloadFlightCore-149b0235433865d419f438025d60eb4885cf6258.tar.gz
FlightCore-149b0235433865d419f438025d60eb4885cf6258.zip
Delete temp download folder after finished install
Diffstat (limited to 'src-tauri/src/lib.rs')
-rw-r--r--src-tauri/src/lib.rs9
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(())