diff --git a/CHANGELOG.md b/CHANGELOG.md index a7c35a9..564be91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## [0.4.2] + +### Fixed + +- Fixed extracting plugin with different folder name. + ## [0.4.1] ### Fixed diff --git a/src/util.rs b/src/util.rs index 9c9945d..39edc13 100644 --- a/src/util.rs +++ b/src/util.rs @@ -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)?; }