diff --git a/bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/IDFUtil.java b/bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/IDFUtil.java index db55f44d4..da0efb8e6 100644 --- a/bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/IDFUtil.java +++ b/bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/IDFUtil.java @@ -346,14 +346,20 @@ public static String getIDFExtraPaths() public static String getOpenOCDLocation() { String openOCDScriptPath = new IDFEnvironmentVariables().getEnvValue(IDFEnvironmentVariables.OPENOCD_SCRIPTS); - if (!StringUtil.isEmpty(openOCDScriptPath)) + if (StringUtil.isEmpty(openOCDScriptPath)) { - return openOCDScriptPath - .replace(File.separator + "share" + File.separator + "openocd" + File.separator + "scripts", "") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - + File.separator + "bin"; //$NON-NLS-1$ + return StringUtil.EMPTY; + } + try + { + // .../openocd-esp32/share/openocd/scripts -> up 3 -> .../openocd-esp32, then /bin + return Paths.get(openOCDScriptPath).resolve("../../../bin").normalize().toString(); //$NON-NLS-1$ + } + catch (InvalidPathException e) + { + Logger.log(e); + return StringUtil.EMPTY; } - - return StringUtil.EMPTY; } /**