forked from Qortal/qortal
Improved directory cleanup process to avoid leaving empty parent directories lying around.
This commit is contained in:
parent
ffe178c64c
commit
007f567c7a
@ -156,15 +156,8 @@ public class FilesystemUtils {
|
||||
}
|
||||
|
||||
if (cleanup) {
|
||||
// Delete the parent directory if it is empty (and exists in our data/temp directory)
|
||||
Path parentDirectory = path.getParent();
|
||||
if (FilesystemUtils.pathInsideDataOrTempPath(parentDirectory)) {
|
||||
try {
|
||||
Files.deleteIfExists(parentDirectory);
|
||||
} catch (IOException e) {
|
||||
// This part is optional, so ignore failures
|
||||
}
|
||||
}
|
||||
// Delete the parent directories if they are empty (and exist in our data/temp directory)
|
||||
FilesystemUtils.safeDeleteEmptyParentDirectories(path);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user