From ad464fc1b14e92a84b000f81580a6e8e8e081168 Mon Sep 17 00:00:00 2001 From: Malte Langkabel Date: Mon, 24 Feb 2020 19:59:21 +0100 Subject: [PATCH] logic: discard non-existing paths in path detectors (#930) This prevents the automatic path detection from adding paths to the project settings or application settings that cause the "you have missing paths" dialog to pop up when saving the settings. --- .../qt/project_wizard/QtProjectWizard.cpp | 2 +- .../QtProjectWizardContentPreferences.cpp | 6 +- .../paths/QtProjectWizardContentPaths.cpp | 3 +- .../path_detector/CombinedPathDetector.cpp | 26 +++---- .../path_detector/CombinedPathDetector.h | 5 +- .../utility/path_detector/PathDetector.cpp | 13 ++++ .../utility/path_detector/PathDetector.h | 5 +- .../cxx_header/CxxFrameworkPathDetector.cpp | 2 +- .../cxx_header/CxxFrameworkPathDetector.h | 3 +- .../cxx_header/CxxHeaderPathDetector.cpp | 2 +- .../cxx_header/CxxHeaderPathDetector.h | 3 +- .../CxxVs10To14HeaderPathDetector.cpp | 52 +++++++------- .../CxxVs10To14HeaderPathDetector.h | 3 +- .../cxx_header/CxxVs15HeaderPathDetector.cpp | 2 +- .../cxx_header/CxxVs15HeaderPathDetector.h | 4 +- .../java_runtime/JavaPathDetectorLinux.cpp | 72 +++++++++---------- .../java_runtime/JavaPathDetectorLinux.h | 2 +- .../java_runtime/JavaPathDetectorMac.cpp | 2 +- .../java_runtime/JavaPathDetectorMac.h | 4 +- .../java_runtime/JavaPathDetectorWindows.cpp | 2 +- .../java_runtime/JavaPathDetectorWindows.h | 4 +- .../JreSystemLibraryPathDetector.cpp | 2 +- .../JreSystemLibraryPathDetector.h | 3 +- .../MavenPathDetectorUnix.cpp | 2 +- .../maven_executable/MavenPathDetectorUnix.h | 4 +- .../MavenPathDetectorWindows.cpp | 2 +- .../MavenPathDetectorWindows.h | 4 +- 27 files changed, 133 insertions(+), 101 deletions(-) diff --git a/src/lib_gui/qt/project_wizard/QtProjectWizard.cpp b/src/lib_gui/qt/project_wizard/QtProjectWizard.cpp index 99b42ddf..586188dc 100644 --- a/src/lib_gui/qt/project_wizard/QtProjectWizard.cpp +++ b/src/lib_gui/qt/project_wizard/QtProjectWizard.cpp @@ -82,7 +82,7 @@ bool applicationSettingsContainVisualStudioHeaderSearchPaths() utility::getCxxVsHeaderPathDetector(); for (const std::string& detectorName: headerPathDetector->getWorkingDetectorNames()) { - for (const FilePath& path: headerPathDetector->getPaths(detectorName)) + for (const FilePath& path: headerPathDetector->getPathsForDetector(detectorName)) { utility::append(expandedPaths, path.expandEnvironmentVariables()); } diff --git a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentPreferences.cpp b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentPreferences.cpp index a0a32ac4..81798bf0 100644 --- a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentPreferences.cpp +++ b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentPreferences.cpp @@ -651,7 +651,7 @@ void QtProjectWizardContentPreferences::colorSchemeChanged(int index) void QtProjectWizardContentPreferences::javaPathDetectionClicked() { - std::vector paths = m_javaPathDetector->getPaths( + std::vector paths = m_javaPathDetector->getPathsForDetector( m_javaPathDetectorBox->currentText().toStdString()); if (!paths.empty()) { @@ -661,7 +661,7 @@ void QtProjectWizardContentPreferences::javaPathDetectionClicked() void QtProjectWizardContentPreferences::jreSystemLibraryPathsDetectionClicked() { - std::vector paths = m_jreSystemLibraryPathsDetector->getPaths( + std::vector paths = m_jreSystemLibraryPathsDetector->getPathsForDetector( m_jreSystemLibraryPathsDetectorBox->currentText().toStdString()); std::vector oldPaths = m_jreSystemLibraryPaths->getPathsAsAbsolute(); m_jreSystemLibraryPaths->setPaths(utility::unique(utility::concat(oldPaths, paths))); @@ -669,7 +669,7 @@ void QtProjectWizardContentPreferences::jreSystemLibraryPathsDetectionClicked() void QtProjectWizardContentPreferences::mavenPathDetectionClicked() { - std::vector paths = m_mavenPathDetector->getPaths( + std::vector paths = m_mavenPathDetector->getPathsForDetector( m_mavenPathDetectorBox->currentText().toStdString()); if (!paths.empty()) { diff --git a/src/lib_gui/qt/project_wizard/content/paths/QtProjectWizardContentPaths.cpp b/src/lib_gui/qt/project_wizard/content/paths/QtProjectWizardContentPaths.cpp index 488e2746..4443aa54 100644 --- a/src/lib_gui/qt/project_wizard/content/paths/QtProjectWizardContentPaths.cpp +++ b/src/lib_gui/qt/project_wizard/content/paths/QtProjectWizardContentPaths.cpp @@ -166,7 +166,8 @@ void QtProjectWizardContentPaths::addDetection(QGridLayout* layout, int row) void QtProjectWizardContentPaths::detectionClicked() { - std::vector paths = m_pathDetector->getPaths(m_detectorBox->currentText().toStdString()); + std::vector paths = m_pathDetector->getPathsForDetector( + m_detectorBox->currentText().toStdString()); std::vector oldPaths = m_list->getPathsAsDisplayed(); paths = utility::unique(utility::concat(oldPaths, paths)); diff --git a/src/lib_gui/utility/path_detector/CombinedPathDetector.cpp b/src/lib_gui/utility/path_detector/CombinedPathDetector.cpp index 23db7562..028ed6bf 100644 --- a/src/lib_gui/utility/path_detector/CombinedPathDetector.cpp +++ b/src/lib_gui/utility/path_detector/CombinedPathDetector.cpp @@ -22,7 +22,19 @@ std::vector CombinedPathDetector::getWorkingDetectorNames() return names; } -std::vector CombinedPathDetector::getPaths() const +std::vector CombinedPathDetector::getPathsForDetector(const std::string& detectorName) const +{ + for (const std::shared_ptr& detector: m_detectors) + { + if (detector->getName() == detectorName) + { + return detector->getPaths(); + } + } + return std::vector(); +} + +std::vector CombinedPathDetector::doGetPaths() const { for (const std::shared_ptr& detector: m_detectors) { @@ -34,15 +46,3 @@ std::vector CombinedPathDetector::getPaths() const } return std::vector(); } - -std::vector CombinedPathDetector::getPaths(const std::string& detectorName) const -{ - for (const std::shared_ptr& detector: m_detectors) - { - if (detector->getName() == detectorName) - { - return detector->getPaths(); - } - } - return std::vector(); -} diff --git a/src/lib_gui/utility/path_detector/CombinedPathDetector.h b/src/lib_gui/utility/path_detector/CombinedPathDetector.h index 7d61d68b..51a3d41e 100644 --- a/src/lib_gui/utility/path_detector/CombinedPathDetector.h +++ b/src/lib_gui/utility/path_detector/CombinedPathDetector.h @@ -17,10 +17,11 @@ public: std::vector getWorkingDetectorNames(); - std::vector getPaths() const override; - std::vector getPaths(const std::string& detectorName) const; + std::vector getPathsForDetector(const std::string& detectorName) const; private: + std::vector doGetPaths() const override; + std::vector> m_detectors; }; diff --git a/src/lib_gui/utility/path_detector/PathDetector.cpp b/src/lib_gui/utility/path_detector/PathDetector.cpp index 8d2d076d..a6a84a0e 100644 --- a/src/lib_gui/utility/path_detector/PathDetector.cpp +++ b/src/lib_gui/utility/path_detector/PathDetector.cpp @@ -9,6 +9,19 @@ std::string PathDetector::getName() const return m_name; } +std::vector PathDetector::getPaths() const +{ + std::vector paths; + for (const FilePath& path: doGetPaths()) + { + if (path.exists()) + { + paths.push_back(path); + } + } + return paths; +} + bool PathDetector::isWorking() const { return (!getPaths().empty()); diff --git a/src/lib_gui/utility/path_detector/PathDetector.h b/src/lib_gui/utility/path_detector/PathDetector.h index fd12ea27..32842a15 100644 --- a/src/lib_gui/utility/path_detector/PathDetector.h +++ b/src/lib_gui/utility/path_detector/PathDetector.h @@ -13,11 +13,14 @@ public: virtual ~PathDetector() = default; std::string getName() const; + std::vector getPaths() const; bool isWorking() const; - virtual std::vector getPaths() const = 0; protected: const std::string m_name; + +private: + virtual std::vector doGetPaths() const = 0; }; #endif // PATH_DETECTOR_BASE_H diff --git a/src/lib_gui/utility/path_detector/cxx_header/CxxFrameworkPathDetector.cpp b/src/lib_gui/utility/path_detector/cxx_header/CxxFrameworkPathDetector.cpp index 5f3484c3..db7a7b9d 100644 --- a/src/lib_gui/utility/path_detector/cxx_header/CxxFrameworkPathDetector.cpp +++ b/src/lib_gui/utility/path_detector/cxx_header/CxxFrameworkPathDetector.cpp @@ -9,7 +9,7 @@ CxxFrameworkPathDetector::CxxFrameworkPathDetector(const std::string& compilerNa { } -std::vector CxxFrameworkPathDetector::getPaths() const +std::vector CxxFrameworkPathDetector::doGetPaths() const { std::vector paths = utility::getCxxHeaderPaths(m_compilerName); std::vector frameworkPaths; diff --git a/src/lib_gui/utility/path_detector/cxx_header/CxxFrameworkPathDetector.h b/src/lib_gui/utility/path_detector/cxx_header/CxxFrameworkPathDetector.h index 1bc634ad..99ab741a 100644 --- a/src/lib_gui/utility/path_detector/cxx_header/CxxFrameworkPathDetector.h +++ b/src/lib_gui/utility/path_detector/cxx_header/CxxFrameworkPathDetector.h @@ -7,9 +7,10 @@ class CxxFrameworkPathDetector: public PathDetector { public: CxxFrameworkPathDetector(const std::string& compilerName); - std::vector getPaths() const override; private: + std::vector doGetPaths() const override; + const std::string m_compilerName; }; diff --git a/src/lib_gui/utility/path_detector/cxx_header/CxxHeaderPathDetector.cpp b/src/lib_gui/utility/path_detector/cxx_header/CxxHeaderPathDetector.cpp index 533ea5ee..dfb0a56c 100644 --- a/src/lib_gui/utility/path_detector/cxx_header/CxxHeaderPathDetector.cpp +++ b/src/lib_gui/utility/path_detector/cxx_header/CxxHeaderPathDetector.cpp @@ -9,7 +9,7 @@ CxxHeaderPathDetector::CxxHeaderPathDetector(const std::string& compilerName) { } -std::vector CxxHeaderPathDetector::getPaths() const +std::vector CxxHeaderPathDetector::doGetPaths() const { std::vector paths = utility::getCxxHeaderPaths(m_compilerName); std::vector headerSearchPaths; diff --git a/src/lib_gui/utility/path_detector/cxx_header/CxxHeaderPathDetector.h b/src/lib_gui/utility/path_detector/cxx_header/CxxHeaderPathDetector.h index 41137c8f..3ef1aa7f 100644 --- a/src/lib_gui/utility/path_detector/cxx_header/CxxHeaderPathDetector.h +++ b/src/lib_gui/utility/path_detector/cxx_header/CxxHeaderPathDetector.h @@ -7,9 +7,10 @@ class CxxHeaderPathDetector: public PathDetector { public: CxxHeaderPathDetector(const std::string& compilerName); - std::vector getPaths() const override; private: + std::vector doGetPaths() const override; + const std::string m_compilerName; }; diff --git a/src/lib_gui/utility/path_detector/cxx_header/CxxVs10To14HeaderPathDetector.cpp b/src/lib_gui/utility/path_detector/cxx_header/CxxVs10To14HeaderPathDetector.cpp index df7319aa..165a15d5 100644 --- a/src/lib_gui/utility/path_detector/cxx_header/CxxVs10To14HeaderPathDetector.cpp +++ b/src/lib_gui/utility/path_detector/cxx_header/CxxVs10To14HeaderPathDetector.cpp @@ -21,32 +21,6 @@ CxxVs10To14HeaderPathDetector::CxxVs10To14HeaderPathDetector( { } -std::vector CxxVs10To14HeaderPathDetector::getPaths() const -{ - const FilePath vsInstallPath = getVsInstallPathUsingRegistry(); - - // vc++ headers - std::vector headerSearchPaths; - if (vsInstallPath.exists()) - { - for (const std::wstring& subdirectory: {L"vc/include", L"vc/atlmfc/include"}) - { - FilePath headerSearchPath = vsInstallPath.getConcatenated(subdirectory); - if (headerSearchPath.exists()) - { - headerSearchPaths.push_back(headerSearchPath.makeCanonical()); - } - } - } - - if (!headerSearchPaths.empty()) - { - utility::append(headerSearchPaths, utility::getWindowsSdkHeaderSearchPaths(m_architecture)); - } - - return headerSearchPaths; -} - int CxxVs10To14HeaderPathDetector::visualStudioTypeToVersion(const VisualStudioType t) { switch (t) @@ -80,6 +54,32 @@ std::string CxxVs10To14HeaderPathDetector::visualStudioTypeToString(const Visual return ret; } +std::vector CxxVs10To14HeaderPathDetector::doGetPaths() const +{ + const FilePath vsInstallPath = getVsInstallPathUsingRegistry(); + + // vc++ headers + std::vector headerSearchPaths; + if (vsInstallPath.exists()) + { + for (const std::wstring& subdirectory: {L"vc/include", L"vc/atlmfc/include"}) + { + FilePath headerSearchPath = vsInstallPath.getConcatenated(subdirectory); + if (headerSearchPath.exists()) + { + headerSearchPaths.push_back(headerSearchPath.makeCanonical()); + } + } + } + + if (!headerSearchPaths.empty()) + { + utility::append(headerSearchPaths, utility::getWindowsSdkHeaderSearchPaths(m_architecture)); + } + + return headerSearchPaths; +} + FilePath CxxVs10To14HeaderPathDetector::getVsInstallPathUsingRegistry() const { QString key = "HKEY_LOCAL_MACHINE\\SOFTWARE\\"; diff --git a/src/lib_gui/utility/path_detector/cxx_header/CxxVs10To14HeaderPathDetector.h b/src/lib_gui/utility/path_detector/cxx_header/CxxVs10To14HeaderPathDetector.h index d4c0ec93..c5623df2 100644 --- a/src/lib_gui/utility/path_detector/cxx_header/CxxVs10To14HeaderPathDetector.h +++ b/src/lib_gui/utility/path_detector/cxx_header/CxxVs10To14HeaderPathDetector.h @@ -17,12 +17,13 @@ public: CxxVs10To14HeaderPathDetector( VisualStudioType type, bool isExpress, ApplicationArchitectureType architecture); - std::vector getPaths() const override; private: static int visualStudioTypeToVersion(const VisualStudioType t); static std::string visualStudioTypeToString(const VisualStudioType t); + std::vector doGetPaths() const override; + FilePath getVsInstallPathUsingRegistry() const; const int m_version; diff --git a/src/lib_gui/utility/path_detector/cxx_header/CxxVs15HeaderPathDetector.cpp b/src/lib_gui/utility/path_detector/cxx_header/CxxVs15HeaderPathDetector.cpp index dbaf852d..0ad9eb75 100644 --- a/src/lib_gui/utility/path_detector/cxx_header/CxxVs15HeaderPathDetector.cpp +++ b/src/lib_gui/utility/path_detector/cxx_header/CxxVs15HeaderPathDetector.cpp @@ -10,7 +10,7 @@ CxxVs15HeaderPathDetector::CxxVs15HeaderPathDetector(): PathDetector("Visual Studio 2017") {} -std::vector CxxVs15HeaderPathDetector::getPaths() const +std::vector CxxVs15HeaderPathDetector::doGetPaths() const { std::vector headerSearchPaths; diff --git a/src/lib_gui/utility/path_detector/cxx_header/CxxVs15HeaderPathDetector.h b/src/lib_gui/utility/path_detector/cxx_header/CxxVs15HeaderPathDetector.h index 8529e983..e5564f21 100644 --- a/src/lib_gui/utility/path_detector/cxx_header/CxxVs15HeaderPathDetector.h +++ b/src/lib_gui/utility/path_detector/cxx_header/CxxVs15HeaderPathDetector.h @@ -8,7 +8,9 @@ class CxxVs15HeaderPathDetector: public PathDetector { public: CxxVs15HeaderPathDetector(); - std::vector getPaths() const override; + +private: + std::vector doGetPaths() const override; }; #endif // CXX_VS_15_HEADER_PATH_DETECTOR_H diff --git a/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorLinux.cpp b/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorLinux.cpp index a581a01e..0c18e6f9 100644 --- a/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorLinux.cpp +++ b/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorLinux.cpp @@ -16,6 +16,42 @@ JavaPathDetectorLinux::JavaPathDetectorLinux(const std::string javaVersion) { } +std::vector JavaPathDetectorLinux::doGetPaths() const +{ + std::vector paths; + FilePath p = getJavaInPath(); + if (!p.empty()) + { + paths.push_back(p); + } + p = getJavaInJavaHome(); + if (!p.empty()) + { + paths.push_back(p); + } + + // some default paths for java + paths.push_back(FilePath(L"/etc/alternatives/java")); + paths.push_back(FilePath(L"/usr/lib/jvm/default/bin/java")); + paths.push_back(FilePath(L"/usr/lib/jvm/java-openjdk/bin/java")); + + for (const FilePath& path: paths) + { + if (checkVersion(path)) + { + FilePath absoluteJavaPath = readLink(path); + FilePath jvmLibrary = getFilePathRelativeToJavaExecutable(absoluteJavaPath); + if (jvmLibrary.exists()) + { + std::vector foundPath = {jvmLibrary}; + return foundPath; + } + } + } + + return std::vector(); +} + FilePath JavaPathDetectorLinux::getJavaInPath() const { std::string command = "which java"; @@ -84,39 +120,3 @@ bool JavaPathDetectorLinux::checkVersion(const FilePath& path) const return output.find(m_javaVersion) != std::string::npos; } - -std::vector JavaPathDetectorLinux::getPaths() const -{ - std::vector paths; - FilePath p = getJavaInPath(); - if (!p.empty()) - { - paths.push_back(p); - } - p = getJavaInJavaHome(); - if (!p.empty()) - { - paths.push_back(p); - } - - // some default paths for java - paths.push_back(FilePath(L"/etc/alternatives/java")); - paths.push_back(FilePath(L"/usr/lib/jvm/default/bin/java")); - paths.push_back(FilePath(L"/usr/lib/jvm/java-openjdk/bin/java")); - - for (const FilePath& path: paths) - { - if (checkVersion(path)) - { - FilePath absoluteJavaPath = readLink(path); - FilePath jvmLibrary = getFilePathRelativeToJavaExecutable(absoluteJavaPath); - if (jvmLibrary.exists()) - { - std::vector foundPath = {jvmLibrary}; - return foundPath; - } - } - } - - return std::vector(); -} diff --git a/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorLinux.h b/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorLinux.h index a29f74c9..67796bf2 100644 --- a/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorLinux.h +++ b/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorLinux.h @@ -7,9 +7,9 @@ class JavaPathDetectorLinux: public JavaPathDetector { public: JavaPathDetectorLinux(const std::string javaVersion); - std::vector getPaths() const override; private: + std::vector doGetPaths() const override; FilePath getJavaInPath() const; FilePath readLink(const FilePath& path) const; FilePath getJavaInJavaHome() const; diff --git a/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorMac.cpp b/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorMac.cpp index b3ca6d78..55ef520a 100644 --- a/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorMac.cpp +++ b/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorMac.cpp @@ -9,7 +9,7 @@ JavaPathDetectorMac::JavaPathDetectorMac(const std::string javaVersion) { } -std::vector JavaPathDetectorMac::getPaths() const +std::vector JavaPathDetectorMac::doGetPaths() const { std::vector paths; FilePath javaPath; diff --git a/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorMac.h b/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorMac.h index 526e2491..215b7e99 100644 --- a/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorMac.h +++ b/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorMac.h @@ -7,7 +7,9 @@ class JavaPathDetectorMac: public JavaPathDetector { public: JavaPathDetectorMac(const std::string javaVersion); - virtual std::vector getPaths() const override; + +private: + virtual std::vector doGetPaths() const override; }; #endif // JAVA_PATH_DETECTOR_MAC_H diff --git a/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorWindows.cpp b/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorWindows.cpp index c6fbbc64..1e0b1595 100644 --- a/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorWindows.cpp +++ b/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorWindows.cpp @@ -12,7 +12,7 @@ JavaPathDetectorWindows::JavaPathDetectorWindows(const std::string javaVersion) { } -std::vector JavaPathDetectorWindows::getPaths() const +std::vector JavaPathDetectorWindows::doGetPaths() const { QString key = "HKEY_LOCAL_MACHINE\\SOFTWARE\\"; diff --git a/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorWindows.h b/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorWindows.h index 0dba772d..299f4e0b 100644 --- a/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorWindows.h +++ b/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorWindows.h @@ -7,7 +7,9 @@ class JavaPathDetectorWindows: public JavaPathDetector { public: JavaPathDetectorWindows(const std::string javaVersion); - virtual std::vector getPaths() const override; + +private: + virtual std::vector doGetPaths() const override; }; #endif // JAVA_PATH_DETECTOR_WINDOWS_H diff --git a/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetector.cpp b/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetector.cpp index 147c98e9..c22fe086 100644 --- a/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetector.cpp +++ b/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetector.cpp @@ -13,7 +13,7 @@ JreSystemLibraryPathDetector::JreSystemLibraryPathDetector( { } -std::vector JreSystemLibraryPathDetector::getPaths() const +std::vector JreSystemLibraryPathDetector::doGetPaths() const { std::vector paths; for (const FilePath& jrePath: m_javaPathDetector->getPaths()) diff --git a/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetector.h b/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetector.h index d9dc3b19..5546e891 100644 --- a/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetector.h +++ b/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetector.h @@ -11,9 +11,10 @@ class JreSystemLibraryPathDetector: public PathDetector { public: JreSystemLibraryPathDetector(std::shared_ptr javaPathDetector); - std::vector getPaths() const override; private: + std::vector doGetPaths() const override; + std::shared_ptr m_javaPathDetector; }; diff --git a/src/lib_gui/utility/path_detector/maven_executable/MavenPathDetectorUnix.cpp b/src/lib_gui/utility/path_detector/maven_executable/MavenPathDetectorUnix.cpp index c42aecea..ea428c72 100644 --- a/src/lib_gui/utility/path_detector/maven_executable/MavenPathDetectorUnix.cpp +++ b/src/lib_gui/utility/path_detector/maven_executable/MavenPathDetectorUnix.cpp @@ -5,7 +5,7 @@ MavenPathDetectorUnix::MavenPathDetectorUnix(): PathDetector("Maven for Unix") {} -std::vector MavenPathDetectorUnix::getPaths() const +std::vector MavenPathDetectorUnix::doGetPaths() const { std::string command = "which mvn"; FilePath mavenPath(utility::executeProcess(command.c_str()).second); diff --git a/src/lib_gui/utility/path_detector/maven_executable/MavenPathDetectorUnix.h b/src/lib_gui/utility/path_detector/maven_executable/MavenPathDetectorUnix.h index dd2aef5a..3bcf01b0 100644 --- a/src/lib_gui/utility/path_detector/maven_executable/MavenPathDetectorUnix.h +++ b/src/lib_gui/utility/path_detector/maven_executable/MavenPathDetectorUnix.h @@ -7,7 +7,9 @@ class MavenPathDetectorUnix: public PathDetector { public: MavenPathDetectorUnix(); - std::vector getPaths() const override; + +private: + std::vector doGetPaths() const override; }; #endif // MAVEN_PATH_DETECTOR_UNIX_H diff --git a/src/lib_gui/utility/path_detector/maven_executable/MavenPathDetectorWindows.cpp b/src/lib_gui/utility/path_detector/maven_executable/MavenPathDetectorWindows.cpp index 6d237de7..6d98538f 100644 --- a/src/lib_gui/utility/path_detector/maven_executable/MavenPathDetectorWindows.cpp +++ b/src/lib_gui/utility/path_detector/maven_executable/MavenPathDetectorWindows.cpp @@ -5,7 +5,7 @@ MavenPathDetectorWindows::MavenPathDetectorWindows(): PathDetector("Maven for Windows") {} -std::vector MavenPathDetectorWindows::getPaths() const +std::vector MavenPathDetectorWindows::doGetPaths() const { std::string command = "cmd /c where mvn.cmd && exit"; FilePath mavenPath(utility::executeProcess(command.c_str()).second); diff --git a/src/lib_gui/utility/path_detector/maven_executable/MavenPathDetectorWindows.h b/src/lib_gui/utility/path_detector/maven_executable/MavenPathDetectorWindows.h index 2bc1dcf1..0b449efe 100644 --- a/src/lib_gui/utility/path_detector/maven_executable/MavenPathDetectorWindows.h +++ b/src/lib_gui/utility/path_detector/maven_executable/MavenPathDetectorWindows.h @@ -7,7 +7,9 @@ class MavenPathDetectorWindows: public PathDetector { public: MavenPathDetectorWindows(); - std::vector getPaths() const override; + +private: + std::vector doGetPaths() const override; }; #endif // MAVEN_PATH_DETECTOR_WINDOWS_H