From fc8f6bc7efe043468e385a0998866be8605a4564 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sat, 13 Apr 2013 06:14:38 +0000 Subject: [PATCH] * don't allow file override so people can't mess up their stuff, but allow when src/dest path is the same, i.e. doesn't need any change, for usability reasons --- source/net/sourceforge/filebot/ui/rename/RenameAction.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/net/sourceforge/filebot/ui/rename/RenameAction.java b/source/net/sourceforge/filebot/ui/rename/RenameAction.java index 7de3b093..f5b73094 100644 --- a/source/net/sourceforge/filebot/ui/rename/RenameAction.java +++ b/source/net/sourceforge/filebot/ui/rename/RenameAction.java @@ -171,6 +171,9 @@ class RenameAction extends AbstractAction { if (destinationSet.contains(destination)) throw new IllegalArgumentException("Conflict detected: " + mapping.getValue().getPath()); + if (destination.exists() && !resolveDestination(mapping.getKey(), mapping.getValue(), false).equals(mapping.getKey())) + throw new IllegalArgumentException("File already exists: " + mapping.getValue().getPath()); + // use original mapping values renameMap.put(mapping.getKey(), mapping.getValue()); destinationSet.add(destination);