From db1c3b3f40b9be9fb29065fd75691c1545982e8d Mon Sep 17 00:00:00 2001 From: malte_langkabel Date: Mon, 7 Aug 2017 16:22:54 +0200 Subject: [PATCH] logic: implement prefilling of JRE system library path * if that setting is empty on startup we use the respective path detector to prefill --- src/app/main.cpp | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/src/app/main.cpp b/src/app/main.cpp index cbe6c667..fe113009 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -57,14 +57,35 @@ void prefillJavaRuntimePath() std::vector paths = javaPathDetector->getPaths(); if (!paths.empty()) { - MessageStatus("Run Java runtime path detection, found: " + paths.front().str()); + MessageStatus("Ran Java runtime path detection, found: " + paths.front().str()); settings->setJavaPath(paths.front().str()); settings->save(); } else { - MessageStatus("Run Java runtime path detection, no path found."); + MessageStatus("Ran Java runtime path detection, no path found."); + } + } +} + +void prefillJreSystemLibraryPaths() +{ + std::shared_ptr settings = ApplicationSettings::getInstance(); + if (settings->getJreSystemLibraryPaths().empty()) + { + std::shared_ptr jreSystemLibraryPathsDetector = utility::getJreSystemLibraryPathsDetector(); + std::vector paths = jreSystemLibraryPathsDetector->getPaths(); + if (!paths.empty()) + { + MessageStatus("Ran JRE system library path detection, found: " + paths.front().str()); + + settings->setJreSystemLibraryPaths(paths); + settings->save(); + } + else + { + MessageStatus("Ran JRE system library path detection, no path found."); } } } @@ -78,14 +99,14 @@ void prefillMavenExecutablePath() std::vector paths = mavenPathDetector->getPaths(); if (!paths.empty()) { - MessageStatus("Run Maven executable path detection, found: " + paths.front().str()); + MessageStatus("Ran Maven executable path detection, found: " + paths.front().str()); settings->setMavenPath(paths.front()); settings->save(); } else { - MessageStatus("Run Maven executable path detection, no path found."); + MessageStatus("Ran Maven executable path detection, no path found."); } } } @@ -99,7 +120,7 @@ void prefillCxxHeaderPaths() std::vector paths = cxxHeaderDetector->getPaths(); if (!paths.empty()) { - MessageStatus("Run C/C++ header path detection, found " + std::to_string(paths.size()) + " paths"); + MessageStatus("Ran C/C++ header path detection, found " + std::to_string(paths.size()) + " paths"); settings->setHeaderSearchPaths(paths); settings->save(); @@ -116,7 +137,7 @@ void prefillCxxFrameworkPaths() std::vector paths = cxxFrameworkDetector->getPaths(); if (!paths.empty()) { - MessageStatus("Run C/C++ framework path detection, found " + std::to_string(paths.size()) + " paths"); + MessageStatus("Ran C/C++ framework path detection, found " + std::to_string(paths.size()) + " paths"); settings->setFrameworkSearchPaths(paths); settings->save(); @@ -128,6 +149,7 @@ void prefillPaths() { prefillJavaRuntimePath(); prefillMavenExecutablePath(); + prefillJreSystemLibraryPaths(); prefillCxxHeaderPaths(); prefillCxxFrameworkPaths(); }