mirror of
https://github.com/mitb-archive/filebot
synced 2025-01-14 07:18:03 -05:00
* added file create helper function
This commit is contained in:
parent
c3895a5852
commit
e08fd8799b
source/net/filebot
@ -243,6 +243,10 @@ public class ScriptShellMethods {
|
||||
return FileUtilities.copyAs(self, new File(destination, self.getName()));
|
||||
}
|
||||
|
||||
public static void createFileIfNotExists(File self) throws IOException {
|
||||
FileUtilities.createFileIfNotExists(self);
|
||||
}
|
||||
|
||||
public static File relativize(File self, File other) throws IOException {
|
||||
return self.getCanonicalFile().toPath().relativize(other.getCanonicalFile().toPath()).toFile();
|
||||
}
|
||||
|
@ -156,15 +156,12 @@ public final class FileUtilities {
|
||||
return org.apache.commons.io.FileUtils.deleteQuietly(file);
|
||||
}
|
||||
|
||||
public static File createFileIfNotExists(File file) throws IOException {
|
||||
if (file.isFile()) {
|
||||
return file;
|
||||
public static void createFileIfNotExists(File file) throws IOException {
|
||||
if (!file.isFile()) {
|
||||
// create parent folder structure if necessary & create file
|
||||
Files.createDirectories(file.getParentFile().toPath());
|
||||
Files.createFile(file.toPath()).toFile();
|
||||
}
|
||||
|
||||
// create parent folder structure if necessary
|
||||
Files.createDirectories(file.getParentFile().toPath());
|
||||
// create file
|
||||
return Files.createFile(file.toPath()).toFile();
|
||||
}
|
||||
|
||||
public static byte[] readFile(File source) throws IOException {
|
||||
|
Loading…
Reference in New Issue
Block a user