Skip to content

Commit

Permalink
clean dir if archive failed
Browse files Browse the repository at this point in the history
  • Loading branch information
lxning committed Aug 26, 2023
1 parent 1e1013b commit 4ee03ef
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,12 @@ private static ModelArchive load(String url, File dir, boolean extracted)
failed = false;
return new ModelArchive(manifest, url, dir, extracted);
} finally {
if (extracted && failed) {
FileUtils.deleteQuietly(dir);
if (failed) {
if (Files.isSymbolicLink(dir.toPath())) {
FileUtils.deleteQuietly(dir.getParentFile());
} else {
FileUtils.deleteQuietly(dir);
}
}
}
}
Expand Down

0 comments on commit 4ee03ef

Please sign in to comment.