Merge pull request #257 from asabanas/existing-jvm-cleanup

Fix for #112 - updated existing directories cleanup functionality to remove directories that no longer exist
This commit is contained in:
Michael Bayne
2021-10-19 08:39:16 -07:00
committed by GitHub
@@ -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();
}
} }
} }
} }