Skip to content

Commit

Permalink
fix: don't remove dirs that contain backgrounds
Browse files Browse the repository at this point in the history
  • Loading branch information
flazepe committed Feb 5, 2023
1 parent 0c6216e commit 66b7ebb
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/cleaner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,33 @@ impl Cleaner {
}
}

// Filter out directories that contain core images from the directories component if exist
if !self.args.backgrounds
&& files
.core_images
.files
.iter()
.any(|core_image| core_image.contains('/') || core_image.contains('\\'))
{
let directories = files
.core_images
.files
.iter()
.map(|core_image| {
core_image
.split(if core_image.contains('/') { '/' } else { '\\' })
.collect::<Vec<&str>>()[0]
})
.collect::<Vec<&str>>();

files.directories.files = files
.directories
.files
.into_iter()
.filter(|directory| !directories.contains(&directory.as_str()))
.collect();
}

// Filter out core images from all images
files.images.files = files
.images
Expand Down

0 comments on commit 66b7ebb

Please sign in to comment.