1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-08-13 17:03:45 -04:00

* convenience functions

This commit is contained in:
Reinhard Pointner 2014-05-12 08:25:42 +00:00
parent 0438e4756f
commit 5a287ab4c4
2 changed files with 18 additions and 4 deletions

View File

@ -48,12 +48,12 @@ public class ScriptShellMethods {
return new File(self, name);
}
public static File resolve(File self, Object name) {
return new File(self, name.toString());
public static File resolve(File self, String name) {
return new File(self, name);
}
public static File resolveSibling(File self, Object name) {
return new File(self.getParentFile(), name.toString());
public static File resolveSibling(File self, String name) {
return new File(self.getParentFile(), name);
}
public static List<File> listFiles(File self, Closure<?> closure) {

View File

@ -313,7 +313,21 @@ public class ExpressionFormatMethods {
}
public static File toFile(String self) {
if (self == null || self.isEmpty()) {
return null;
}
return new File(self);
}
public static File toFile(String self, String parent) {
if (self == null || self.isEmpty()) {
return null;
}
File file = new File(self);
if (file.isAbsolute()) {
return file;
}
return new File(parent, self);
}
}