From 1369086b4bc069839a65495e9d84e6d56fd37f66 Mon Sep 17 00:00:00 2001 From: Maciej Cenkar Date: Fri, 3 Mar 2023 14:15:45 +0100 Subject: [PATCH] fix: https://github.com/julianpeeters/sbt-avrohugger/issues/94 Files were generated into not-existing folder, added call to create all missing parent folders. --- .../src/main/scala/format/abstractions/SourceFormat.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/avrohugger-core/src/main/scala/format/abstractions/SourceFormat.scala b/avrohugger-core/src/main/scala/format/abstractions/SourceFormat.scala index 06a50f35..7284daae 100644 --- a/avrohugger-core/src/main/scala/format/abstractions/SourceFormat.scala +++ b/avrohugger-core/src/main/scala/format/abstractions/SourceFormat.scala @@ -222,7 +222,8 @@ trait SourceFormat { } val contents = compilationUnit.codeString.getBytes() try { // delete old and/or create new - Files.deleteIfExists(path) + Files.deleteIfExists(path) // delete file if exists + Files.createDirectories(path.getParent) // create all parent folders Files.write(path, contents, StandardOpenOption.CREATE) () } @@ -232,4 +233,4 @@ trait SourceFormat { } } -} \ No newline at end of file +}