From 23eb722e2da9d43f25dd959f2990c534e78f7b90 Mon Sep 17 00:00:00 2001 From: Denys Almazov Date: Thu, 18 Jun 2026 20:05:07 +0300 Subject: [PATCH 1/2] fix: changed approach for resolving correct openocd path --- .../src/com/espressif/idf/core/util/IDFUtil.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) 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..01bfee217 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,10 @@ public static String getIDFExtraPaths() public static String getOpenOCDLocation() { String openOCDScriptPath = new IDFEnvironmentVariables().getEnvValue(IDFEnvironmentVariables.OPENOCD_SCRIPTS); - 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; + if (StringUtil.isEmpty(openOCDScriptPath)) + return StringUtil.EMPTY; + // .../openocd-esp32/share/openocd/scripts -> up 3 -> .../openocd-esp32, then /bin + return Paths.get(openOCDScriptPath).resolve("../../../bin").normalize().toString(); //$NON-NLS-1$ } /** From c6b27050aee86163886d4522e3a7f4a03405ff6f Mon Sep 17 00:00:00 2001 From: Denys Almazov Date: Fri, 19 Jun 2026 11:47:21 +0300 Subject: [PATCH 2/2] feat: handling exception in getting openocdPATH --- .../src/com/espressif/idf/core/util/IDFUtil.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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 01bfee217..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 @@ -347,9 +347,19 @@ public static String getOpenOCDLocation() { String openOCDScriptPath = new IDFEnvironmentVariables().getEnvValue(IDFEnvironmentVariables.OPENOCD_SCRIPTS); if (StringUtil.isEmpty(openOCDScriptPath)) + { + 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; - // .../openocd-esp32/share/openocd/scripts -> up 3 -> .../openocd-esp32, then /bin - return Paths.get(openOCDScriptPath).resolve("../../../bin").normalize().toString(); //$NON-NLS-1$ + } } /**