* using FastFile might be useful for scripting (esp. with slow remote file systems)
This commit is contained in:
parent
e4bd68b026
commit
1968608d80
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue