From 0292e9b3bdd377f08b0552a5c02183b90c8b3c69 Mon Sep 17 00:00:00 2001 From: Tomasz Godzik Date: Tue, 22 Oct 2024 12:40:55 +0200 Subject: [PATCH] bugfix: Create reports directory if it doesn't exist Fixes https://github.com/scalameta/metals/issues/6870 --- .../scala/meta/internal/metals/ZipReportsProvider.scala | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/metals/src/main/scala/scala/meta/internal/metals/ZipReportsProvider.scala b/metals/src/main/scala/scala/meta/internal/metals/ZipReportsProvider.scala index 141a1ac8ce2..990c8ba6188 100644 --- a/metals/src/main/scala/scala/meta/internal/metals/ZipReportsProvider.scala +++ b/metals/src/main/scala/scala/meta/internal/metals/ZipReportsProvider.scala @@ -64,10 +64,9 @@ object ZipReportsProvider { folders: List[FolderReportsZippper], additionalToZip: List[FileToZip], ): AbsolutePath = { - val path = AbsolutePath( - folders.head.reportContext.reportsDir - .resolve(StdReportContext.ZIP_FILE_NAME) - ) + val reportsDir = folders.head.reportContext.reportsDir + Files.createDirectories(reportsDir) + val path = AbsolutePath(reportsDir.resolve(StdReportContext.ZIP_FILE_NAME)) val zipOut = new ZipOutputStream(Files.newOutputStream(path.toNIO)) for {