* replace -clear option with 2 options -clear-cache and -clear-prefs
This commit is contained in:
parent
d82c37a3fe
commit
cfa959cd38
|
@ -84,17 +84,22 @@ public class Main {
|
|||
System.exit(0);
|
||||
}
|
||||
|
||||
// make sure java.io.tmpdir exists
|
||||
File tmpdir = new File(System.getProperty("java.io.tmpdir"));
|
||||
tmpdir.mkdirs();
|
||||
|
||||
// initialize this stuff before anything else
|
||||
initializeCache();
|
||||
initializeSecurityManager();
|
||||
|
||||
// make sure tmpdir exists
|
||||
File tmpdir = new File(System.getProperty("java.io.tmpdir"));
|
||||
tmpdir.mkdirs();
|
||||
|
||||
if (args.clearUserData()) {
|
||||
System.out.println("Reset preferences");
|
||||
Settings.forPackage(Main.class).clear();
|
||||
}
|
||||
|
||||
if (args.clearCache()) {
|
||||
// clear preferences and cache
|
||||
System.out.println("Reset preferences and clear 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()) {
|
||||
|
@ -102,11 +107,7 @@ public class Main {
|
|||
}
|
||||
}
|
||||
}
|
||||
Settings.forPackage(Main.class).clear();
|
||||
CacheManager.getInstance().clearAll();
|
||||
|
||||
// just clear all data and then exit
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
// set unixfs system property
|
||||
|
|
|
@ -90,8 +90,11 @@ public class ArgumentBean {
|
|||
@Option(name = "-open", usage = "Open file in GUI", metaVar = "file")
|
||||
public boolean open = false;
|
||||
|
||||
@Option(name = "-clear", usage = "Clear cache and application settings")
|
||||
public boolean clear = false;
|
||||
@Option(name = "-clear-cache", usage = "Clear cached and temporary data")
|
||||
public boolean clearCache = false;
|
||||
|
||||
@Option(name = "-clear-prefs", usage = "Clear application settings")
|
||||
public boolean clearPrefs = false;
|
||||
|
||||
@Option(name = "-unixfs", usage = "Do not strip invalid characters from file paths")
|
||||
public boolean unixfs = false;
|
||||
|
@ -113,7 +116,7 @@ public class ArgumentBean {
|
|||
|
||||
|
||||
public boolean runCLI() {
|
||||
return rename || getSubtitles || getMissingSubtitles || check || list || mediaInfo || extract || clear || script != null;
|
||||
return rename || getSubtitles || getMissingSubtitles || check || list || mediaInfo || extract || script != null;
|
||||
}
|
||||
|
||||
|
||||
|
@ -132,8 +135,13 @@ public class ArgumentBean {
|
|||
}
|
||||
|
||||
|
||||
public boolean clearCache() {
|
||||
return clearCache;
|
||||
}
|
||||
|
||||
|
||||
public boolean clearUserData() {
|
||||
return clear;
|
||||
return clearPrefs;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -335,7 +335,6 @@
|
|||
<td>output charset</td>
|
||||
<td>UTF-8, windows-1252, GB18030, etc</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr>
|
||||
<td>-list</td>
|
||||
<td>print episode list</td>
|
||||
|
@ -357,10 +356,16 @@
|
|||
<td>all, config, info, warning</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>-clear</td>
|
||||
<td>clear cache and preferences</td>
|
||||
<td>-clear-cache</td>
|
||||
<td>clear cache</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>-clear-prefs</td>
|
||||
<td>reset application settings</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>-no-analytics</td>
|
||||
<td>disable analytics</td>
|
||||
<td></td>
|
||||
|
|
Loading…
Reference in New Issue