Skip to content

Commit

Permalink
Merge pull request #4018 from freimair/fix_hsdir_getting_deleted
Browse files Browse the repository at this point in the history
Fix false deletion of hsdir when using --appDataDir
  • Loading branch information
sqrrm committed Mar 7, 2020
2 parents 72bcc4a + 0b7788a commit 4c3a562
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions common/src/main/java/bisq/common/storage/FileUtil.java
Expand Up @@ -108,14 +108,14 @@ public static void deleteDirectory(File file, @Nullable File exclude, boolean ig
File[] files = file.listFiles();
if (files != null)
for (File f : files) {
if (!excludeFileFound)
excludeFileFound = f.equals(exclude);
if (!f.equals(exclude))
boolean excludeFileFoundLocal = exclude != null ? f.getAbsolutePath().equals(exclude.getAbsolutePath()) : false;
excludeFileFound |= excludeFileFoundLocal;
if (!excludeFileFoundLocal)
deleteDirectory(f, exclude, ignoreLockedFiles);
}
}
// Finally delete main file/dir if exclude file was not found in directory
if (!excludeFileFound && !file.equals(exclude)) {
if (!excludeFileFound && !(exclude != null ? file.getAbsolutePath().equals(exclude.getAbsolutePath()) : false)) {
try {
deleteFileIfExists(file, ignoreLockedFiles);
} catch (Throwable t) {
Expand Down

0 comments on commit 4c3a562

Please sign in to comment.