mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-23 16:28:51 -05:00
* convenience functions
This commit is contained in:
parent
0438e4756f
commit
5a287ab4c4
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user