From b9cdd0ffffae3e7591b776aa3c3b8b8517f1fc78 Mon Sep 17 00:00:00 2001 From: Karol Stasiak Date: Fri, 3 Jan 2020 16:13:54 +0100 Subject: [PATCH] Fix for output directory creation (#21) --- src/main/scala/millfork/Main.scala | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/scala/millfork/Main.scala b/src/main/scala/millfork/Main.scala index 840a5b1d..55f7acac 100644 --- a/src/main/scala/millfork/Main.scala +++ b/src/main/scala/millfork/Main.scala @@ -76,13 +76,15 @@ object Main { } val outputParent = new File(output).getParentFile - if (outputParent.exists()) { - if (!outputParent.canWrite || !outputParent.isDirectory) { - errorReporting.warn(s"The output directory `${outputParent.getAbsolutePath}` cannot be written to.") - } - } else { - if (!outputParent.mkdirs()) { - errorReporting.warn(s"Failed to create the output directory `${outputParent.getAbsolutePath}``") + if (outputParent ne null) { + if (outputParent.exists()) { + if (!outputParent.canWrite || !outputParent.isDirectory) { + errorReporting.warn(s"The output directory `${outputParent.getAbsolutePath}` cannot be written to.") + } + } else { + if (!outputParent.mkdirs()) { + errorReporting.warn(s"Failed to create the output directory `${outputParent.getAbsolutePath}``") + } } }