Skip to content

Commit

Permalink
Remove unused deps
Browse files Browse the repository at this point in the history
  • Loading branch information
RedstoneWizard08 committed Mar 20, 2023
1 parent 1db0404 commit 0b7e23b
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 16 deletions.
8 changes: 3 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ authors = ["RedstoneWizard08", "Rexicon226", "cheese3660", "Wormhole Contributor
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
zip-extensions = "0.6.1"
keyvalues-parser = "0.1.0"
ckandex = "0.4.2"
tokio = { version = "1.26.0", features = ["full"] }
reqwest = { version = "0.11.14", features = ["stream", "gzip"] }
tokio-util = { version = "0.7.7", features = ["full"] }
tokio-stream = { version = "0.1.12", features = ["tokio-util", "fs", "net", "sync"] }
rusqlite = { version = "0.28.0", features = ["bundled"] }
rand = "0.8.5"
Expand Down
11 changes: 9 additions & 2 deletions common/src/installer/bepinex.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
use zip::ZipArchive;

use crate::downloader::Downloader;
use std::{fs, path::PathBuf};
use std::{
fs::{self, File},
path::PathBuf,
};

pub struct BepInExInstallManager {
pub ksp2_install_path: PathBuf,
Expand Down Expand Up @@ -63,7 +68,9 @@ impl BepInExInstallManager {
)
.await;

zip_extensions::read::zip_extract(&out_file, &self.ksp2_install_path)
let mut zip = ZipArchive::new(File::open(out_file.clone()).unwrap()).unwrap();

zip.extract(self.ksp2_install_path.clone())
.expect("Could not extract the BepInEx release!");

fs::remove_file(out_file).expect("Could not delete the BepInEx release file!");
Expand Down
25 changes: 18 additions & 7 deletions common/src/installer/spacewarp.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
use zip::ZipArchive;

use crate::{
downloader::Downloader, installer::bepinex::BepInExInstallManager,
releases::get_latest_release_zips,
};

use std::{fs, path::PathBuf};
use std::{
fs::{self, File},
path::PathBuf,
};

pub struct SpaceWarpInstallManager {
pub ksp2_install_path: PathBuf,
Expand Down Expand Up @@ -81,13 +86,19 @@ impl SpaceWarpInstallManager {

let out_file = self.ksp2_install_path.join(".spacewarp_release.zip");

Downloader::download(download_url, out_file, on_progress, on_finish, window).await;

zip_extensions::read::zip_extract(
&PathBuf::from(&self.ksp2_install_path.join(".spacewarp_release.zip")),
&PathBuf::from(&self.ksp2_install_path),
Downloader::download(
download_url,
out_file.clone(),
on_progress,
on_finish,
window,
)
.expect("Could not extract the SpaceWarp release!");
.await;

let mut zip = ZipArchive::new(File::open(out_file).unwrap()).unwrap();

zip.extract(self.ksp2_install_path.clone())
.expect("Could not extract the SpaceWarp release!");

fs::remove_file(self.ksp2_install_path.join(".spacewarp_release.zip"))
.expect("Could not delete the SpaceWarp release file!");
Expand Down

0 comments on commit 0b7e23b

Please sign in to comment.