* don't keep history of --action test rename operations

This commit is contained in:
Reinhard Pointner 2013-03-30 16:46:25 +00:00
parent ad2bbbdabb
commit 1f0efe713f
2 changed files with 10 additions and 3 deletions

View File

@ -31,12 +31,13 @@ public final class HistorySpooler {
private File persistentHistoryFile = new File(getApplicationFolder(), "history.xml"); private File persistentHistoryFile = new File(getApplicationFolder(), "history.xml");
private int persistentHistoryTotalSize = -1; private int persistentHistoryTotalSize = -1;
private boolean persistentHistoryEnabled = true;
private History sessionHistory = new History(); private History sessionHistory = new History();
public synchronized History getCompleteHistory() throws IOException { public synchronized History getCompleteHistory() throws IOException {
if (persistentHistoryFile.length() <= 0) { if (!persistentHistoryEnabled || persistentHistoryFile.length() <= 0) {
return new History(); return new History();
} }
@ -59,7 +60,7 @@ public final class HistorySpooler {
public synchronized void commit() { public synchronized void commit() {
if (sessionHistory.sequences().isEmpty()) { if (!persistentHistoryEnabled || sessionHistory.sequences().isEmpty()) {
return; return;
} }
@ -121,4 +122,9 @@ public final class HistorySpooler {
return persistentHistoryTotalSize; return persistentHistoryTotalSize;
} }
public void setPersistentHistoryEnabled(boolean persistentHistoryEnabled) {
this.persistentHistoryEnabled = persistentHistoryEnabled;
}
} }

View File

@ -146,6 +146,7 @@ public class Main {
if (args.action.equalsIgnoreCase("test")) { if (args.action.equalsIgnoreCase("test")) {
System.setProperty("useExtendedFileAttributes", "false"); System.setProperty("useExtendedFileAttributes", "false");
System.setProperty("application.analytics", "false"); System.setProperty("application.analytics", "false");
HistorySpooler.getInstance().setPersistentHistoryEnabled(false); // don't keep history of --action test rename operations
} }
// initialize analytics // initialize analytics
@ -351,7 +352,7 @@ public class Main {
private static void showDonationReminder() { private static void showDonationReminder() {
int renameCount = HistorySpooler.getInstance().getPersistentHistoryTotalSize(); int renameCount = HistorySpooler.getInstance().getPersistentHistoryTotalSize();
if (renameCount <= 0) if (renameCount < 2000)
return; return;
PreferencesEntry<String> donation = Settings.forPackage(Main.class).entry("donation").defaultValue("0"); PreferencesEntry<String> donation = Settings.forPackage(Main.class).entry("donation").defaultValue("0");