Skip to content

Commit

Permalink
fix folder rename
Browse files Browse the repository at this point in the history
  • Loading branch information
8LWXpg committed Sep 30, 2024
1 parent 4696432 commit d572986
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## [0.4.2]

### Fixed

- Fixed extracting plugin with different folder name.

## [0.4.1]

### Fixed
Expand Down
6 changes: 4 additions & 2 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,13 @@ fn extract_zip(zip_path: &Path, output_dir: &Path, root_name: &str) -> Result<()
}
}

let extracted_root = output_dir.join(archive.by_index(0)?.name());
let extracted_root = output_dir.join(archive.by_index(0)?.name().split('/').next().unwrap());
let root_path = output_dir.join(root_name);
if extracted_root != root_path {
// extracting to a different directory means we're not done polling for file access during extracting.
polling::remove_dir_all(&root_path)?;
if root_path.exists() {
polling::remove_dir_all(&root_path)?;
}
fs::rename(extracted_root, &root_path)?;
}

Expand Down

0 comments on commit d572986

Please sign in to comment.