From 3c1306ec2c36479a2ded0b370bff1841209fae13 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Wed, 16 Apr 2014 14:37:52 +0000 Subject: [PATCH] * allow Windows case-change only if filename differs --- source/net/sourceforge/filebot/ui/rename/RenameAction.java | 3 ++- source/net/sourceforge/filebot/util/FileUtilities.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/source/net/sourceforge/filebot/ui/rename/RenameAction.java b/source/net/sourceforge/filebot/ui/rename/RenameAction.java index 9c538dc8..d8c23155 100644 --- a/source/net/sourceforge/filebot/ui/rename/RenameAction.java +++ b/source/net/sourceforge/filebot/ui/rename/RenameAction.java @@ -303,7 +303,8 @@ class RenameAction extends AbstractAction { // rename file, throw exception on failure File source = mapping.getKey(); 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); } diff --git a/source/net/sourceforge/filebot/util/FileUtilities.java b/source/net/sourceforge/filebot/util/FileUtilities.java index d2a27bf9..eb8602e4 100644 --- a/source/net/sourceforge/filebot/util/FileUtilities.java +++ b/source/net/sourceforge/filebot/util/FileUtilities.java @@ -55,7 +55,7 @@ public final class FileUtilities { } 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) 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) { java.nio.file.Files.move(source.toPath(), destination.toPath(), StandardCopyOption.REPLACE_EXISTING); }