From 1f0efe713f5ec1cee60d3c43efa9f49020aeb5a3 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sat, 30 Mar 2013 16:46:25 +0000 Subject: [PATCH] * don't keep history of --action test rename operations --- source/net/sourceforge/filebot/HistorySpooler.java | 10 ++++++++-- source/net/sourceforge/filebot/Main.java | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/source/net/sourceforge/filebot/HistorySpooler.java b/source/net/sourceforge/filebot/HistorySpooler.java index 6022cbde..7c016859 100644 --- a/source/net/sourceforge/filebot/HistorySpooler.java +++ b/source/net/sourceforge/filebot/HistorySpooler.java @@ -31,12 +31,13 @@ public final class HistorySpooler { private File persistentHistoryFile = new File(getApplicationFolder(), "history.xml"); private int persistentHistoryTotalSize = -1; + private boolean persistentHistoryEnabled = true; private History sessionHistory = new History(); public synchronized History getCompleteHistory() throws IOException { - if (persistentHistoryFile.length() <= 0) { + if (!persistentHistoryEnabled || persistentHistoryFile.length() <= 0) { return new History(); } @@ -59,7 +60,7 @@ public final class HistorySpooler { public synchronized void commit() { - if (sessionHistory.sequences().isEmpty()) { + if (!persistentHistoryEnabled || sessionHistory.sequences().isEmpty()) { return; } @@ -121,4 +122,9 @@ public final class HistorySpooler { return persistentHistoryTotalSize; } + + public void setPersistentHistoryEnabled(boolean persistentHistoryEnabled) { + this.persistentHistoryEnabled = persistentHistoryEnabled; + } + } diff --git a/source/net/sourceforge/filebot/Main.java b/source/net/sourceforge/filebot/Main.java index 565d56eb..d6cb0177 100644 --- a/source/net/sourceforge/filebot/Main.java +++ b/source/net/sourceforge/filebot/Main.java @@ -146,6 +146,7 @@ public class Main { if (args.action.equalsIgnoreCase("test")) { System.setProperty("useExtendedFileAttributes", "false"); System.setProperty("application.analytics", "false"); + HistorySpooler.getInstance().setPersistentHistoryEnabled(false); // don't keep history of --action test rename operations } // initialize analytics @@ -351,7 +352,7 @@ public class Main { private static void showDonationReminder() { int renameCount = HistorySpooler.getInstance().getPersistentHistoryTotalSize(); - if (renameCount <= 0) + if (renameCount < 2000) return; PreferencesEntry donation = Settings.forPackage(Main.class).entry("donation").defaultValue("0");