* using FastFile might be useful for scripting (esp. with slow remote file systems)

This commit is contained in:
Reinhard Pointner 2014-08-02 06:07:41 +00:00
parent e4bd68b026
commit 1968608d80
2 changed files with 11 additions and 0 deletions

View File

@ -29,6 +29,7 @@ import net.filebot.media.MetaAttributes;
import net.filebot.similarity.NameSimilarityMetric;
import net.filebot.similarity.Normalization;
import net.filebot.similarity.SimilarityMetric;
import net.filebot.util.FastFile;
import net.filebot.util.FileUtilities;
import net.filebot.web.WebRequest;
@ -218,6 +219,10 @@ public class ScriptShellMethods {
return FileUtilities.validateFilePath(self);
}
public static FastFile memoize(File self) {
return new FastFile(self.getPath());
}
public static File moveTo(File self, File destination) throws IOException {
return FileUtilities.moveRename(self, destination);
}

View File

@ -16,6 +16,7 @@ public class FastFile extends File {
private String[] list;
private File[] listFiles;
private String canonicalPath;
public FastFile(String path) {
super(path);
@ -50,6 +51,11 @@ public class FastFile extends File {
return lastModified != null ? lastModified : (lastModified = super.lastModified());
}
@Override
public String getCanonicalPath() throws IOException {
return canonicalPath != null ? canonicalPath : (canonicalPath = super.getCanonicalPath());
}
@Override
public String[] list() {
if (list != null) {