Updated existing directories cleanup functionality to remove all their contents when unpacking archives.

This commit is contained in:
Andrius Šabanas
2021-09-28 23:21:28 +03:00
parent 7def118e31
commit bfd5571377
@@ -113,7 +113,7 @@ public final class FileUtil
/** /**
* Unpacks the specified jar file into the specified target directory. * Unpacks the specified jar file into the specified target directory.
* @param cleanExistingDirs if true, all files in all directories contained in {@code jar} will * @param cleanExistingDirs if true, all files and subdirectories in all directories contained in {@code jar} will
* be deleted prior to unpacking the jar. * be deleted prior to unpacking the jar.
*/ */
public static void unpackJar (ZipFile jar, File target, boolean cleanExistingDirs) public static void unpackJar (ZipFile jar, File target, boolean cleanExistingDirs)
@@ -126,10 +126,7 @@ public final class FileUtil
if (entry.isDirectory()) { if (entry.isDirectory()) {
File efile = new File(target, entry.getName()); File efile = new File(target, entry.getName());
if (efile.exists()) { if (efile.exists()) {
for (File f : efile.listFiles()) { deleteDirHarder(efile);
if (!f.isDirectory())
f.delete();
}
} }
} }
} }