Browse Source

Fixed bug introduced in commit 51b1256

qdn
CalDescent 3 years ago
parent
commit
8f3620e07b
  1. 8
      src/main/java/org/qortal/arbitrary/ArbitraryDataFile.java

8
src/main/java/org/qortal/arbitrary/ArbitraryDataFile.java

@ -349,9 +349,13 @@ public class ArbitraryDataFile {
}
protected void cleanupFilesystem() {
// It is essential that use a separate path reference in this method
// as we don't want to modify this.filePath
Path path = this.filePath;
// Iterate through two levels of parent directories, and delete if empty
for (int i=0; i<2; i++) {
Path directory = this.filePath.getParent().toAbsolutePath();
Path directory = path.getParent().toAbsolutePath();
try (Stream<Path> files = Files.list(directory)) {
final long count = files.count();
if (count == 0) {
@ -362,7 +366,7 @@ public class ArbitraryDataFile {
} catch (IOException e) {
LOGGER.warn("Unable to count files in directory", e);
}
this.filePath = directory;
path = directory;
}
}

Loading…
Cancel
Save