From 8a26af9e6a2abb052b8ae2a598af7ec33a7c804e Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Mon, 11 Feb 2013 04:17:56 +0000 Subject: [PATCH] * enable file override if forced by user --- source/net/sourceforge/filebot/Main.java | 2 +- source/net/sourceforge/tuned/FileUtilities.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/source/net/sourceforge/filebot/Main.java b/source/net/sourceforge/filebot/Main.java index 625e646f..7afa6d7f 100644 --- a/source/net/sourceforge/filebot/Main.java +++ b/source/net/sourceforge/filebot/Main.java @@ -119,7 +119,7 @@ public class Main { if (args.unixfs) { System.setProperty("unixfs", "true"); } - if (args.disableAnalytics) { + if (args.disableAnalytics || args.action.equalsIgnoreCase("test")) { System.setProperty("application.analytics", "false"); } diff --git a/source/net/sourceforge/tuned/FileUtilities.java b/source/net/sourceforge/tuned/FileUtilities.java index ce38b4e7..e78dedf9 100644 --- a/source/net/sourceforge/tuned/FileUtilities.java +++ b/source/net/sourceforge/tuned/FileUtilities.java @@ -15,6 +15,7 @@ import java.io.StringWriter; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; import java.nio.charset.Charset; +import java.nio.file.StandardCopyOption; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -52,7 +53,7 @@ public final class FileUtilities { } else { // move file try { - java.nio.file.Files.move(source.toPath(), destination.toPath()); + java.nio.file.Files.move(source.toPath(), destination.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.COPY_ATTRIBUTES); } catch (LinkageError e) { org.apache.commons.io.FileUtils.moveFile(source, destination); // use "copy and delete" as fallback if standard rename fails } @@ -72,7 +73,7 @@ public final class FileUtilities { } else { // copy file try { - java.nio.file.Files.copy(source.toPath(), destination.toPath()); + java.nio.file.Files.copy(source.toPath(), destination.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.COPY_ATTRIBUTES); } catch (LinkageError e) { org.apache.commons.io.FileUtils.copyFile(source, destination); }