Skip to content

Commit

Permalink
rename variable
Browse files Browse the repository at this point in the history
  • Loading branch information
infeo committed Aug 9, 2023
1 parent 6901c32 commit 28566e5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/java/org/cryptomator/cryptofs/CryptoFileSystemImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -621,18 +621,18 @@ private void moveDirectory(CryptoPath cleartextSource, CryptoPath cleartextTarge
throw new AtomicMoveNotSupportedException(cleartextSource.toString(), cleartextTarget.toString(), "Replacing directories during move requires non-atomic status checks.");
}
// check if dir is empty:
Path oldCiphertextDir = cryptoPathMapper.getCiphertextDir(cleartextTarget).path;
boolean oldCiphertextDirExists = true;
try (DirectoryStream<Path> ds = Files.newDirectoryStream(oldCiphertextDir)) {
Path targetCiphertextDirContentDir = cryptoPathMapper.getCiphertextDir(cleartextTarget).path;
boolean targetCiphertextDirExists = true;
try (DirectoryStream<Path> ds = Files.newDirectoryStream(targetCiphertextDirContentDir)) {
if (ds.iterator().hasNext()) {
throw new DirectoryNotEmptyException(cleartextTarget.toString());
}
} catch (NoSuchFileException e) {
oldCiphertextDirExists = false;
targetCiphertextDirExists = false;
}
// cleanup dir to be replaced:
if (oldCiphertextDirExists) {
Files.walkFileTree(oldCiphertextDir, DeletingFileVisitor.INSTANCE);
if (targetCiphertextDirExists) {
Files.walkFileTree(targetCiphertextDirContentDir, DeletingFileVisitor.INSTANCE);
}
Files.walkFileTree(ciphertextTarget.getRawPath(), DeletingFileVisitor.INSTANCE);
}
Expand Down

0 comments on commit 28566e5

Please sign in to comment.