diff --git a/src/open_ocd_task.rs b/src/open_ocd_task.rs index 948e9a1..e75a4fe 100644 --- a/src/open_ocd_task.rs +++ b/src/open_ocd_task.rs @@ -123,7 +123,7 @@ where .into_string() .map_err(|_| "Failed to convert tmp_dir to string.")?; - let cmd = cmd.args(&[ + cmd.args(&[ "-s", &config_folder, "-s", @@ -132,6 +132,15 @@ where &ws_foler, ]); + // The xpack-bundled OpenOCD ships its standard scripts alongside the + // executable in `/scripts/`. Our .cfg files reference these via + // `source [find interface/...]`, which only resolves through OpenOCD's + // search path — add the directory if it exists. + let scripts_folder = dirs::get_exe_dir()?.join("scripts"); + if scripts_folder.is_dir() { + cmd.arg("-s").arg(&scripts_folder); + } + let mut child = cmd .stdout(Stdio::piped()) .stderr(Stdio::piped())