diff options
author | GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> | 2023-07-07 23:25:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-07 23:25:11 +0200 |
commit | 977b6b3971fcb1ba78e8373fc08bd3db2ae3ada9 (patch) | |
tree | f3cbeb1d33f5d07bce835c48c17c43aa21a31239 /src-tauri | |
parent | 5911c0e0ccd289e58e41a80d4c097665baf43603 (diff) | |
download | FlightCore-977b6b3971fcb1ba78e8373fc08bd3db2ae3ada9.tar.gz FlightCore-977b6b3971fcb1ba78e8373fc08bd3db2ae3ada9.zip |
chore: Bump libthermite to `0.6.5` (#409)
And update code accordingly
Co-authored-by: AnActualEmerald <emerald_actual@protonmail.com>
Diffstat (limited to 'src-tauri')
-rw-r--r-- | src-tauri/Cargo.lock | 4 | ||||
-rw-r--r-- | src-tauri/Cargo.toml | 2 | ||||
-rw-r--r-- | src-tauri/src/mod_management/mod.rs | 18 | ||||
-rw-r--r-- | src-tauri/src/northstar/install.rs | 10 |
4 files changed, 25 insertions, 9 deletions
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 2ad8286c..fcc76853 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -1995,9 +1995,9 @@ checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" [[package]] name = "libthermite" -version = "0.5.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d8ef144beaf1e683b0ccb2e6e3e14d1e6a8f29e28be3c4fc93376539b28fe97" +checksum = "27cd844bbc25676cd14fa9ad04cc40e0f3c4d5c66107ef3a99896db1f81324c0" dependencies = [ "json5", "serde", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index a0c61b52..ab3b9007 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -33,7 +33,7 @@ steamlocate = "1.2" # Error messages anyhow = "1.0" # libthermite for Northstar/mod install handling -libthermite = "0.5.3" +libthermite = "0.6.5" # zip stuff zip = "0.6.2" # Regex diff --git a/src-tauri/src/mod_management/mod.rs b/src-tauri/src/mod_management/mod.rs index 5d745f64..d1cc366e 100644 --- a/src-tauri/src/mod_management/mod.rs +++ b/src-tauri/src/mod_management/mod.rs @@ -427,9 +427,19 @@ pub async fn fc_download_mod_and_install( ); // Download the mod - let temp_file = match thermite::core::manage::download_file(download_url, &path) { - Ok(f) => TempFile::new(f, path.into()), - Err(e) => return Err(e.to_string()), + let temp_file = TempFile::new( + std::fs::File::options() + .read(true) + .write(true) + .truncate(true) + .create(true) + .open(&path) + .map_err(|e| e.to_string())?, + (&path).into(), + ); + match thermite::core::manage::download(temp_file.file(), download_url) { + Ok(_written_bytes) => (), + Err(err) => return Err(err.to_string()), }; // Get Thunderstore mod author @@ -441,7 +451,7 @@ pub async fn fc_download_mod_and_install( temp_file.file(), std::path::Path::new(&mods_directory), ) { - Ok(()) => (), + Ok(_) => (), Err(err) => { log::warn!("libthermite couldn't install mod {thunderstore_mod_string} due to {err:?}",); return Err(err.to_string()); diff --git a/src-tauri/src/northstar/install.rs b/src-tauri/src/northstar/install.rs index bfaf9d3d..875458dd 100644 --- a/src-tauri/src/northstar/install.rs +++ b/src-tauri/src/northstar/install.rs @@ -48,9 +48,15 @@ async fn do_install( log::info!("Download path: {download_path}"); let last_emit = RefCell::new(Instant::now()); // Keep track of the last time a signal was emitted - let nfile = thermite::core::manage::download_file_with_progress( + let mut nfile = std::fs::File::options() + .read(true) + .write(true) + .truncate(true) + .create(true) + .open(download_path)?; + thermite::core::manage::download_with_progress( + &mut nfile, &nmod.url, - download_path, |delta, current, total| { if delta != 0 { // Only emit a signal once every 100ms |