Compatibility fix

This commit is contained in:
Reinhard Pointner 2016-11-26 01:37:09 +08:00
parent 9af9706e4a
commit 94f5e5ade4
8 changed files with 11 additions and 14 deletions

View File

@ -21,7 +21,7 @@ public enum ApplicationFolder {
this.path = new File(path);
}
public File getFile() {
public File get() {
return path;
}

View File

@ -66,11 +66,8 @@ public class CacheManager {
}
private File acquireDiskStore() throws IOException {
// prepare cache folder for this application instance
File cacheRoot = ApplicationFolder.Cache.getFile();
for (int i = 0; i < 10; i++) {
File cache = new File(cacheRoot, Integer.toString(i));
File cache = ApplicationFolder.Cache.resolve(String.valueOf(i));
// make sure cache is readable and writable
createFolders(cache);
@ -124,7 +121,7 @@ public class CacheManager {
}
// serious error, abort
throw new IOException("Unable to acquire cache lock: " + cacheRoot);
throw new IOException("Unable to acquire cache lock: " + ApplicationFolder.Cache.get().getAbsolutePath());
}
private static class ShutdownHook extends Thread {

View File

@ -91,7 +91,7 @@ public class Main {
// clear caches
if (args.clearCache()) {
log.info("Clear cache");
for (File folder : getChildren(ApplicationFolder.Cache.getFile(), FOLDERS)) {
for (File folder : getChildren(ApplicationFolder.Cache.get(), FOLDERS)) {
log.fine("* Delete " + folder);
delete(folder);
}
@ -377,8 +377,8 @@ public class Main {
public static void initializeLogging(ArgumentBean args) throws IOException {
// make sure that these folders exist
ApplicationFolder.TemporaryFiles.getFile().mkdirs();
ApplicationFolder.AppData.getFile().mkdirs();
ApplicationFolder.TemporaryFiles.get().mkdirs();
ApplicationFolder.AppData.get().mkdirs();
if (args.runCLI()) {
// CLI logging settings

View File

@ -928,7 +928,7 @@ public class MediaBindingBean {
@Define("home")
public File getUserHome() {
return ApplicationFolder.UserHome.getFile();
return ApplicationFolder.UserHome.get();
}
@Define("output")

View File

@ -57,7 +57,7 @@ public class SecureCompiledScript extends CompiledScript {
// write permissions for cache and temp folders
for (ApplicationFolder it : ApplicationFolder.values()) {
permissions.add(new FilePermission(it.getFile().getAbsolutePath() + File.separator + "-", "read, write, delete"));
permissions.add(new FilePermission(it.get().getAbsolutePath() + File.separator + "-", "read, write, delete"));
}
return permissions;

View File

@ -1012,7 +1012,7 @@ public class MediaDetection {
}
public static boolean isStructureRoot(File folder) throws Exception {
return isVolumeRoot(folder) || releaseInfo.getStructureRootPattern().matcher(folder.getName()).matches() || ApplicationFolder.UserHome.getFile().equals(folder.getParentFile());
return isVolumeRoot(folder) || releaseInfo.getStructureRootPattern().matcher(folder.getName()).matches() || ApplicationFolder.UserHome.get().equals(folder.getParentFile());
}
public static File getStructureRoot(File file) throws Exception {

View File

@ -220,7 +220,7 @@ public class ReleaseInfo {
if (volumeRoots == null) {
Set<File> volumes = new HashSet<File>();
File home = ApplicationFolder.UserHome.getFile();
File home = ApplicationFolder.UserHome.get();
List<File> roots = getFileSystemRoots();
// user root folder

View File

@ -160,7 +160,7 @@ public class RenamePanel extends JComponent {
renameModel.useFormatter(FileInfo.class, new FileNameFormatter());
}
RenameListCellRenderer cellrenderer = new RenameListCellRenderer(renameModel, ApplicationFolder.UserHome.getFile());
RenameListCellRenderer cellrenderer = new RenameListCellRenderer(renameModel, ApplicationFolder.UserHome.get());
namesList.getListComponent().setCellRenderer(cellrenderer);
filesList.getListComponent().setCellRenderer(cellrenderer);