* allow Windows case-change only if filename differs
This commit is contained in:
parent
68df1b7c09
commit
3c1306ec2c
|
@ -303,7 +303,8 @@ class RenameAction extends AbstractAction {
|
||||||
// rename file, throw exception on failure
|
// rename file, throw exception on failure
|
||||||
File source = mapping.getKey();
|
File source = mapping.getKey();
|
||||||
File destination = resolveDestination(mapping.getKey(), mapping.getValue(), false);
|
File destination = resolveDestination(mapping.getKey(), mapping.getValue(), false);
|
||||||
if (!source.getAbsolutePath().equals(destination.getAbsolutePath())) {
|
boolean isSameFile = source.equals(destination);
|
||||||
|
if (!isSameFile || (isSameFile && !source.getName().equals(destination.getName()))) {
|
||||||
action.rename(source, destination);
|
action.rename(source, destination);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ public final class FileUtilities {
|
||||||
} else {
|
} else {
|
||||||
// on Windows ATOMIC_MOVE allows us to rename files even if only lower/upper-case changes (without ATOMIC_MOVE the operation would be ignored)
|
// on Windows ATOMIC_MOVE allows us to rename files even if only lower/upper-case changes (without ATOMIC_MOVE the operation would be ignored)
|
||||||
try {
|
try {
|
||||||
java.nio.file.Files.move(source.toPath(), destination.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE);
|
java.nio.file.Files.move(source.toPath(), destination.toPath(), StandardCopyOption.ATOMIC_MOVE);
|
||||||
} catch (AtomicMoveNotSupportedException e) {
|
} catch (AtomicMoveNotSupportedException e) {
|
||||||
java.nio.file.Files.move(source.toPath(), destination.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
java.nio.file.Files.move(source.toPath(), destination.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue