From f540a51a348dd9b883bdc55842086b64a69dc70d Mon Sep 17 00:00:00 2001 From: Anton Krug Date: Thu, 4 Jan 2018 10:20:10 +0000 Subject: [PATCH] ${eclipse_home} macro can be used in binary path --- .../src/com/googlecode/cppcheclipse/core/Checker.java | 3 ++- .../com/googlecode/cppcheclipse/core/CppcheclipsePlugin.java | 3 ++- .../src/com/googlecode/cppcheclipse/ui/UpdateCheck.java | 3 ++- .../cppcheclipse/ui/preferences/BinaryPathPreferencePage.java | 4 +++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/com.googlecode.cppcheclipse.core/src/com/googlecode/cppcheclipse/core/Checker.java b/com.googlecode.cppcheclipse.core/src/com/googlecode/cppcheclipse/core/Checker.java index 1b2e1f9..d5aef69 100644 --- a/com.googlecode.cppcheclipse.core/src/com/googlecode/cppcheclipse/core/Checker.java +++ b/com.googlecode.cppcheclipse.core/src/com/googlecode/cppcheclipse/core/Checker.java @@ -74,7 +74,8 @@ public Checker(IConsole console, IPreferenceStore projectPreferences, } String binaryPath = CppcheclipsePlugin.getConfigurationPreferenceStore() - .getString(IPreferenceConstants.P_BINARY_PATH); + .getString(IPreferenceConstants.P_BINARY_PATH) + .replace("${eclipse_home}", System.getProperty("eclipse.home.location").replace("file:/", "")); command = new CppcheckCommand(console, binaryPath, settingsPreferences, projectPreferences, toolchainSettings.getUserIncludes(), toolchainSettings.getSystemIncludes(), symbols); diff --git a/com.googlecode.cppcheclipse.core/src/com/googlecode/cppcheclipse/core/CppcheclipsePlugin.java b/com.googlecode.cppcheclipse.core/src/com/googlecode/cppcheclipse/core/CppcheclipsePlugin.java index fa801ab..f6f639d 100644 --- a/com.googlecode.cppcheclipse.core/src/com/googlecode/cppcheclipse/core/CppcheclipsePlugin.java +++ b/com.googlecode.cppcheclipse.core/src/com/googlecode/cppcheclipse/core/CppcheclipsePlugin.java @@ -157,7 +157,8 @@ public boolean removeChangeListener(IPropertyChangeListener listener) { private synchronized ProblemProfile getInternalNewProblemProfile(IConsole console, IPreferenceStore store) throws CloneNotSupportedException, XPathExpressionException, IOException, InterruptedException, ParserConfigurationException, SAXException, ProcessExecutionException { if (profile == null) { String binaryPath = CppcheclipsePlugin.getConfigurationPreferenceStore() - .getString(IPreferenceConstants.P_BINARY_PATH); + .getString(IPreferenceConstants.P_BINARY_PATH) + .replace("${eclipse_home}", System.getProperty("eclipse.home.location").replace("file:/", "")); profile = new ProblemProfile(console, binaryPath); registerChangeListener(); addChangeListener(profile); diff --git a/com.googlecode.cppcheclipse.ui/src/com/googlecode/cppcheclipse/ui/UpdateCheck.java b/com.googlecode.cppcheclipse.ui/src/com/googlecode/cppcheclipse/ui/UpdateCheck.java index 6c915f8..2bba67d 100644 --- a/com.googlecode.cppcheclipse.ui/src/com/googlecode/cppcheclipse/ui/UpdateCheck.java +++ b/com.googlecode.cppcheclipse.ui/src/com/googlecode/cppcheclipse/ui/UpdateCheck.java @@ -94,7 +94,8 @@ public static boolean startUpdateCheck() { // do not start another update check, if one is already running if (UpdateCheck.needUpdateCheck()) { String binaryPath = CppcheclipsePlugin.getConfigurationPreferenceStore() - .getString(IPreferenceConstants.P_BINARY_PATH); + .getString(IPreferenceConstants.P_BINARY_PATH) + .replace("${eclipse_home}", System.getProperty("eclipse.home.location").replace("file:/", "")); new UpdateCheck(true).check(binaryPath); return true; } diff --git a/com.googlecode.cppcheclipse.ui/src/com/googlecode/cppcheclipse/ui/preferences/BinaryPathPreferencePage.java b/com.googlecode.cppcheclipse.ui/src/com/googlecode/cppcheclipse/ui/preferences/BinaryPathPreferencePage.java index 5f6a8da..b287f07 100644 --- a/com.googlecode.cppcheclipse.ui/src/com/googlecode/cppcheclipse/ui/preferences/BinaryPathPreferencePage.java +++ b/com.googlecode.cppcheclipse.ui/src/com/googlecode/cppcheclipse/ui/preferences/BinaryPathPreferencePage.java @@ -116,7 +116,9 @@ protected boolean checkState() { if (super.checkState()) { // check if it is valid cppcheck binary try { - String path = getTextControl().getText(); + String path = getTextControl().getText() + .replace("${eclipse_home}", System.getProperty("eclipse.home.location").replace("file:/", "")); + VersionCommand versionCommand = new VersionCommand( Console.getInstance(), path); Version version = versionCommand