Add support for absolute paths to CreateContactSheet

This commit is contained in:
0xb00bface 2021-09-06 15:09:09 +02:00
parent 9b9659be71
commit b591553c86
1 changed files with 15 additions and 1 deletions

View File

@ -66,7 +66,10 @@ public class CreateContactSheet extends AbstractPlaceholderAwarePostProcessor {
color},
new StringBuffer(), null).toString();
File executionDir = rec.getPostProcessedFile().isDirectory() ? rec.getPostProcessedFile() : rec.getPostProcessedFile().getParentFile();
File output = new File(executionDir, fillInPlaceHolders(filename, ctx));
File output = getOutputFile(executionDir, filename, ctx);
if (!output.getParentFile().exists()) {
Files.createDirectories(output.toPath().getParent());
}
String[] args = {
"-y",
@ -95,6 +98,17 @@ public class CreateContactSheet extends AbstractPlaceholderAwarePostProcessor {
return true;
}
private File getOutputFile(File executionDir, String filename, PostProcessingContext ctx) {
String finalFilename = fillInPlaceHolders(filename, ctx);
File output;
if (new File(finalFilename).isAbsolute()) {
output = new File(finalFilename);
} else {
output = new File(executionDir, finalFilename);
}
return output;
}
private Path createThumbnails(Recording rec, Config config) throws IOException, InterruptedException {
Path tempDirectory = Files.createTempDirectory("ctbrec-contactsheet-" + rec.getModel().getSanitizedNamed());
File executionDir = rec.getPostProcessedFile().isDirectory() ? rec.getPostProcessedFile() : rec.getPostProcessedFile().getParentFile();