Skip to content

Commit

Permalink
Merge pull request #63 from glencoesoftware/createdir
Browse files Browse the repository at this point in the history
Create directories when setting outputs
  • Loading branch information
sbesson authored May 7, 2024
2 parents b00c33d + f47fb4b commit dd90194
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/com/glencoesoftware/convert/tasks/Output.java
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ public int applySettings() {
if (txt == null || txt.isEmpty()) logFileLocation = output.getParentFile();
else {
logFileLocation = new File(txt);
if (logFileLocation.mkdirs()) { LOGGER.debug("Created directory: " + logFileLocation); }
if (!logFileLocation.canWrite()) {
errors++;
if (!logDirectory.getStyleClass().contains("setting-warn"))
Expand All @@ -214,6 +215,7 @@ public int applySettings() {
if (txt == null || txt.isEmpty()) trueWorkingDirectory = null;
else {
trueWorkingDirectory = new File(txt);
if (trueWorkingDirectory.mkdirs()) { LOGGER.debug("Created directory: " + trueWorkingDirectory); }
if (!trueWorkingDirectory.canWrite()) {
errors++;
if (!workingDirectoryField.getStyleClass().contains("setting-warn"))
Expand All @@ -223,6 +225,9 @@ public int applySettings() {
// Recalculate job IO in case the user switched temp directory
if (input != null) parent.calculateIO();
outputFileName.getStyleClass().remove("setting-warn");
if (output != null && output.getParentFile().mkdirs()) {
LOGGER.debug("Created output directory: " + output.getParent());
}
if (output != null && !output.getParentFile().canWrite()) {
errors++;
if (!outputFileName.getStyleClass().contains("setting-warn"))
Expand Down

0 comments on commit dd90194

Please sign in to comment.