forked from Qortal/qortal
Fixed bug introduced in commit 51b1256
This commit is contained in:
parent
190f70f332
commit
8f3620e07b
@ -349,9 +349,13 @@ public class ArbitraryDataFile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void cleanupFilesystem() {
|
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
|
// Iterate through two levels of parent directories, and delete if empty
|
||||||
for (int i=0; i<2; i++) {
|
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)) {
|
try (Stream<Path> files = Files.list(directory)) {
|
||||||
final long count = files.count();
|
final long count = files.count();
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
@ -362,7 +366,7 @@ public class ArbitraryDataFile {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOGGER.warn("Unable to count files in directory", e);
|
LOGGER.warn("Unable to count files in directory", e);
|
||||||
}
|
}
|
||||||
this.filePath = directory;
|
path = directory;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user