mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-25 09:18:51 -05:00
* exit on -clear-cache or -clear-prefs
This commit is contained in:
parent
41f08070e0
commit
b7a9d524cb
@ -88,6 +88,31 @@ public class Main {
|
|||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args.clearCache() || args.clearUserData()) {
|
||||||
|
if (args.clearUserData()) {
|
||||||
|
System.out.println("Reset preferences");
|
||||||
|
Settings.forPackage(Main.class).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.clearCache()) {
|
||||||
|
// clear preferences and cache
|
||||||
|
System.out.println("Clear cache and temporary files");
|
||||||
|
for (File cache : getApplicationFolder().listFiles(FOLDERS)) {
|
||||||
|
if (matches("cache|temp|grape", cache.getName())) {
|
||||||
|
for (File it : cache.listFiles()) {
|
||||||
|
delete(it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
initializeCache();
|
||||||
|
CacheManager.getInstance().clearAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
// just clear cache and/or settings and then exit
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
// tee stdout and stderr to log file if set
|
// tee stdout and stderr to log file if set
|
||||||
if (args.logFile != null) {
|
if (args.logFile != null) {
|
||||||
File logFile = new File(args.logFile);
|
File logFile = new File(args.logFile);
|
||||||
@ -118,24 +143,6 @@ public class Main {
|
|||||||
initializeCache();
|
initializeCache();
|
||||||
initializeSecurityManager();
|
initializeSecurityManager();
|
||||||
|
|
||||||
if (args.clearUserData()) {
|
|
||||||
System.out.println("Reset preferences");
|
|
||||||
Settings.forPackage(Main.class).clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.clearCache()) {
|
|
||||||
// clear preferences and cache
|
|
||||||
System.out.println("Clear cache and temporary files");
|
|
||||||
for (File cache : getApplicationFolder().listFiles(FOLDERS)) {
|
|
||||||
if (matches("cache|temp|grape", cache.getName())) {
|
|
||||||
for (File it : cache.listFiles()) {
|
|
||||||
delete(it);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CacheManager.getInstance().clearAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
// update system properties
|
// update system properties
|
||||||
if (System.getProperty("http.agent") == null) {
|
if (System.getProperty("http.agent") == null) {
|
||||||
System.setProperty("http.agent", String.format("%s %s", getApplicationName(), getApplicationVersion()));
|
System.setProperty("http.agent", String.format("%s %s", getApplicationName(), getApplicationVersion()));
|
||||||
|
Loading…
Reference in New Issue
Block a user