Skip to content

Commit

Permalink
change: on windows it will no longer write versions inside platform_n…
Browse files Browse the repository at this point in the history
…ame/...
  • Loading branch information
MordechaiHadad committed Jul 23, 2024
1 parent 0119f3b commit 909d6e3
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/helpers/unarchive.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use anyhow::{anyhow, Result};
use std::fs;
use std::{
fs,
path::{Path, PathBuf},
};

use super::version::types::LocalVersion;

Expand Down Expand Up @@ -210,10 +213,11 @@ fn expand(downloaded_file: LocalVersion) -> Result<()> {
std::fs::create_dir(downloaded_file.file_name.clone())?;

let mut downloaded: u64 = 0;

for i in 0..archive.len() {
let mut file = archive.by_index(i)?;
let temp = &format!("{}/{}", downloaded_file.file_name, file.name());
let outpath = Path::new(temp);
let file_path = remove_base_parent(&file.mangled_name()).unwrap();
let outpath = Path::new(&downloaded_file.file_name).join(file_path);

if file.is_dir() {
fs::create_dir_all(outpath)?;
Expand Down Expand Up @@ -363,3 +367,11 @@ fn expand(downloaded_file: LocalVersion) -> Result<()> {
fs::set_permissions(file, perms)?;
Ok(())
}

fn remove_base_parent(path: &Path) -> Option<PathBuf> {

Check warning on line 371 in src/helpers/unarchive.rs

View workflow job for this annotation

GitHub Actions / check (macos-latest)

function `remove_base_parent` is never used

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

View workflow job for this annotation

GitHub Actions / clippy (ubuntu-latest)

function `remove_base_parent` is never used

Check warning on line 371 in src/helpers/unarchive.rs

View workflow job for this annotation

GitHub Actions / check (ubuntu-latest)

function `remove_base_parent` is never used

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

View workflow job for this annotation

GitHub Actions / clippy (macos-latest)

function `remove_base_parent` is never used

Check warning on line 371 in src/helpers/unarchive.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

function `remove_base_parent` is never used

Check warning on line 371 in src/helpers/unarchive.rs

View workflow job for this annotation

GitHub Actions / test (macos-latest)

function `remove_base_parent` is never used
let mut components = path.components();

components.next();

Some(components.as_path().to_path_buf())
}

0 comments on commit 909d6e3

Please sign in to comment.