Skip to content

Commit

Permalink
debugging stuff ig
Browse files Browse the repository at this point in the history
  • Loading branch information
MordechaiHadad committed Jul 31, 2024
1 parent 4ecdd61 commit 2704b30
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/handlers/install_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,11 +343,11 @@ async fn download_version(
let mut response_bytes = response.bytes_stream();

// Progress Bar Setup
let pb = ProgressBar::new(total_size);
pb.set_style(ProgressStyle::default_bar()
.template("{msg}\n{spinner:.green} [{elapsed_precise}] [{wide_bar:.cyan/blue}] {bytes}/{total_bytes} ({bytes_per_sec}, {eta})")
.progress_chars("█ "));
pb.set_message(format!("Downloading version: {}", version.tag_name));
// let pb = ProgressBar::new(total_size);
// pb.set_style(ProgressStyle::default_bar()
// .template("{msg}\n{spinner:.green} [{elapsed_precise}] [{wide_bar:.cyan/blue}] {bytes}/{total_bytes} ({bytes_per_sec}, {eta})")
// .progress_chars("█ "));
// pb.set_message(format!("Downloading version: {}", version.tag_name));

let file_type = helpers::get_file_type();
let mut file =
Expand All @@ -361,15 +361,15 @@ async fn download_version(
file.write_all(&chunk).await?;
let new = min(downloaded + (chunk.len() as u64), total_size);
downloaded = new;
pb.set_position(new);
// pb.set_position(new);
}

pb.finish_with_message(format!(
"Downloaded version {} to {}/{}.{file_type}",
version.tag_name,
root.display(),
version.tag_name
));
// pb.finish_with_message(format!(
// "Downloaded version {} to {}/{}.{file_type}",
// version.tag_name,
// root.display(),
// version.tag_name
// ));

Ok(PostDownloadVersionType::Standard(LocalVersion {
file_name: version.tag_name.to_owned(),
Expand Down
5 changes: 5 additions & 0 deletions src/helpers/unarchive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,18 @@ fn expand(downloaded_file: LocalVersion) -> Result<()> {
pb.set_message("Expanding archive");

let mut downloaded: u64 = 0;
let mut display = true;
for file in archive.entries()? {
match file {
Ok(mut file) => {
let mut outpath = PathBuf::new();
outpath.push(&downloaded_file.file_name);
let no_parent_file = remove_base_parent(&file.path().unwrap()).unwrap();
outpath.push(no_parent_file);
if display {
println!("{} {} {}", outpath.display(), no_parent_file.display(), file.path().unwrap().display());

Check failure on line 329 in src/helpers/unarchive.rs

View workflow job for this annotation

GitHub Actions / clippy (macos-latest)

borrow of moved value: `no_parent_file`

Check failure on line 329 in src/helpers/unarchive.rs

View workflow job for this annotation

GitHub Actions / check (macos-latest)

borrow of moved value: `no_parent_file`

Check failure on line 329 in src/helpers/unarchive.rs

View workflow job for this annotation

GitHub Actions / check (macos-latest)

borrow of moved value: `no_parent_file`

Check failure on line 329 in src/helpers/unarchive.rs

View workflow job for this annotation

GitHub Actions / test (macos-latest)

borrow of moved value: `no_parent_file`

Check failure on line 329 in src/helpers/unarchive.rs

View workflow job for this annotation

GitHub Actions / test (macos-latest)

borrow of moved value: `no_parent_file`
display = false;
}

let file_name = format!("{}", file.path()?.display()); // file.path()?.is_dir() always returns false... weird
if file_name.ends_with('/') {
Expand Down

0 comments on commit 2704b30

Please sign in to comment.