From aeb46e0a7f8a6f18d3e6dae44fdda428944b4a92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Fri, 28 Mar 2025 11:06:02 +0100 Subject: [PATCH] docfix/Add more logging --- .../main/scala/code/api/util/Glossary.scala | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/obp-api/src/main/scala/code/api/util/Glossary.scala b/obp-api/src/main/scala/code/api/util/Glossary.scala index 48e38de18..62999163e 100644 --- a/obp-api/src/main/scala/code/api/util/Glossary.scala +++ b/obp-api/src/main/scala/code/api/util/Glossary.scala @@ -3513,15 +3513,25 @@ object Glossary extends MdcLoggable { .replaceAll("getObpApiRoot", getObpApiRoot) } - private def getListOfFiles():List[File] = { + import java.nio.file.Paths + + private def getListOfFiles(): List[File] = { val currentDir = new File(".").getCanonicalPath - val d = new File(currentDir + "/obp-api/src/main/docs/glossary") - if (d.exists && d.isDirectory) { - d.listFiles.filter(_.isFile).filter(_.getName.endsWith(".md")).toList - } else { - List[File]() - } - } + logger.info(s"|---> Current directory: $currentDir") + + val glossaryPath = Paths.get(currentDir, "obp-api/src/main/docs/glossary").toFile + logger.info(s"|---> Glossary path: $glossaryPath") + + if (glossaryPath.exists && glossaryPath.isDirectory) { + Option(glossaryPath.listFiles()) + .getOrElse(Array.empty) // Avoid NullPointerException + .filter(_.isFile) + .filter(_.getName.endsWith(".md")) + .toList + } else { + List.empty[File] + } + } // Append all files from /OBP-API/docs/glossary as items // File name is used as a title