Skip to content

Commit

Permalink
Bug fix with extracting tarballs
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefanuk12 committed May 27, 2023
1 parent a225d20 commit ebade9b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ zip-extract = "0.1.2"
indicatif = "0.17.3"
futures-util = "0.3.28"
tar = "0.4.38"
flate2 = "1.0.26"
7 changes: 5 additions & 2 deletions src/installer.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Dependencies
use std::{path::PathBuf, io::{Cursor, Write}, fs, cmp::min};
use flate2::bufread::GzDecoder;
use indicatif::{ProgressBar, ProgressStyle};
use reqwest::{header, Client};
use futures_util::StreamExt;
Expand Down Expand Up @@ -179,7 +180,8 @@ pub async fn install_iw4m_log(target_dir: Option<&str>) {
let release_zip = download_file(&client, "https://github.com/Stefanuk12/iw4m-log-server/releases/latest/download/iw4m-log-server-x86_64-unknown-linux-gnu.tar.gz").await.unwrap();

// Extract
let mut archive = tar::Archive::new(Cursor::new(release_zip));
let decompressed = GzDecoder::new(release_zip.as_slice());
let mut archive = tar::Archive::new(decompressed);
archive.unpack(target_dir).expect("unable to extract server files - server files don't exist?");
} else if cfg!(windows) {
// Download the release
Expand Down Expand Up @@ -260,7 +262,8 @@ pub async fn install_rcon(target_dir: Option<&str>) {
let release_zip = download_file(&client, "https://github.com/Stefanuk12/cod-rcon/releases/latest/download/cod-rcon-x86_64-unknown-linux-gnu.tar.gz").await.unwrap();

// Extract
let mut archive = tar::Archive::new(Cursor::new(release_zip));
let decompressed = GzDecoder::new(release_zip.as_slice());
let mut archive = tar::Archive::new(decompressed);
archive.unpack(target_dir).expect("unable to extract server files - server files don't exist?");
} else if cfg!(windows) {
// Download the release
Expand Down

0 comments on commit ebade9b

Please sign in to comment.