summaryrefslogtreecommitdiff
path: root/src/helper/options.c
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-02-25 13:09:15 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-02-25 13:09:15 +0000
commit3b5690ade1b013136ed9b54337c2d5b2c695aa25 (patch)
treedfc1a0a04680722a873b6ec403844e944124dcca /src/helper/options.c
parent687a9553c9cc74a7ca3d3ac5f2470b34e7cc623b (diff)
downloadopenocd+libswd-3b5690ade1b013136ed9b54337c2d5b2c695aa25.tar.gz
openocd+libswd-3b5690ade1b013136ed9b54337c2d5b2c695aa25.tar.bz2
openocd+libswd-3b5690ade1b013136ed9b54337c2d5b2c695aa25.tar.xz
openocd+libswd-3b5690ade1b013136ed9b54337c2d5b2c695aa25.zip
- Fix target library path problem w/Windows
git-svn-id: svn://svn.berlios.de/openocd/trunk@342 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/helper/options.c')
-rw-r--r--src/helper/options.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/helper/options.c b/src/helper/options.c
index b6b2c6dc..1e717be8 100644
--- a/src/helper/options.c
+++ b/src/helper/options.c
@@ -123,10 +123,31 @@ int parse_cmdline_args(struct command_context_s *cmd_ctx, int argc, char *argv[]
exit(-1);
}
+#ifdef _WIN32
+ /* Add the parent of the directory where openocd.exe resides to the
+ * config script search path.
+ * Directory layout:
+ * bin\openocd.exe
+ * lib\openocd
+ * event\at91eb40a_reset.cfg
+ * target\at91eb40a.cfg
+ */
+ {
+ char strExePath [MAX_PATH];
+ GetModuleFileName (NULL, strExePath, MAX_PATH);
+ /* Either this code will *always* work or it will SEGFAULT giving
+ * excellent information on the culprit.
+ */
+ *strrchr(strExePath, '\\')=0;
+ strcat(strExePath, "\\..");
+ add_script_search_dir(strExePath);
+ }
+#else
/* Add dir for openocd supplied scripts last so that user can over
ride those scripts if desired. */
add_script_search_dir(PKGDATADIR);
add_script_search_dir(PKGLIBDIR);
+#endif
return ERROR_OK;
}