Skip to content

Commit 49d573a

Browse files
authored
Fix openOCDRulesPath in addOpenOcdRules.ts (#1685)
On Linux, `dirname(modifiedEnv.OPENOCD_SCRIPTS)` returns `~/.espressif/tools/openocd-esp32/${openocd-esp32-version}/openocd-esp32/share/openocd`. Therefore, the parameter `".."` passed to the `resolve` function makes it return `~/.espressif/tools/openocd-esp32/${openocd-esp32-version}/openocd-esp32/share/contrib/60-openocd.rules`, which missing the `openocd` part between `share` and `contrib`. At the end of the configuration, the message that prompt the user to add OpenOCD rules in `/etc/udev/rules.d` become an error instead: `"~/.espressif/tools/openocd-esp32/${openocd-esp32-version}/openocd-esp32/share/contrib/60-openocd.rules doesn't exists."` Fix this issue by removing the `".."` parameter.
1 parent d76fa81 commit 49d573a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/setup/addOpenOcdRules.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ export async function getOpenOcdRules(workspace: Uri) {
3030
if (!modifiedEnv.OPENOCD_SCRIPTS) {
3131
throw new Error("OPENOCD_SCRIPTS environment variables is not defined");
3232
}
33-
const openOCDRulesPath = resolve(dirname(modifiedEnv.OPENOCD_SCRIPTS), "..", "contrib", "60-openocd.rules");
33+
const openOCDRulesPath = resolve(
34+
dirname(modifiedEnv.OPENOCD_SCRIPTS),
35+
"contrib",
36+
"60-openocd.rules",
37+
);
3438
const doesRulesPathExists = await pathExists(openOCDRulesPath);
3539
if (!doesRulesPathExists) {
3640
throw new Error(`${openOCDRulesPath} doesn't exists.`);

0 commit comments

Comments
 (0)