Refactor
This commit is contained in:
parent
f28800a3a9
commit
83dc1c40f6
|
@ -324,7 +324,7 @@ class RenameAction extends AbstractAction {
|
|||
File source = mapping.getKey();
|
||||
File destination = resolve(mapping.getKey(), mapping.getValue());
|
||||
|
||||
if (!source.equals(destination) || (source.equals(destination) && !source.getName().equals(destination.getName()))) {
|
||||
if (!equalsCaseSensitive(source, destination)) {
|
||||
action.rename(source, destination);
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ public final class FileUtilities {
|
|||
|
||||
// on Windows, use ATOMIC_MOVE which allows us to rename files even if only lower/upper-case changes (without ATOMIC_MOVE the operation would be ignored)
|
||||
// but ATOMIC_MOVE can only work for files on the same drive, if that is not the case there is no point trying move with ATOMIC_MOVE
|
||||
if (isWindows() && source.equals(destination)) {
|
||||
if (source.equals(destination)) {
|
||||
try {
|
||||
return Files.move(source.toPath(), destination.toPath(), StandardCopyOption.ATOMIC_MOVE).toFile();
|
||||
} catch (AtomicMoveNotSupportedException e) {
|
||||
|
@ -246,10 +246,6 @@ public final class FileUtilities {
|
|||
return UTF_8.decode(data).toString();
|
||||
}
|
||||
|
||||
public static boolean isWindows() {
|
||||
return '\\' == File.separatorChar;
|
||||
}
|
||||
|
||||
public static boolean equalsCaseSensitive(File a, File b) {
|
||||
return a.getPath().equals(b.getPath());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue