exit(-1);\r
} \r
\r
+#ifdef _WIN32\r
+ /* Add the parent of the directory where openocd.exe resides to the\r
+ * config script search path.\r
+ * Directory layout: \r
+ * bin\openocd.exe\r
+ * lib\openocd\r
+ * event\at91eb40a_reset.cfg\r
+ * target\at91eb40a.cfg\r
+ */\r
+ {\r
+ char strExePath [MAX_PATH];\r
+ GetModuleFileName (NULL, strExePath, MAX_PATH);\r
+ /* Either this code will *always* work or it will SEGFAULT giving\r
+ * excellent information on the culprit. \r
+ */\r
+ *strrchr(strExePath, '\\')=0;\r
+ strcat(strExePath, "\\..");\r
+ add_script_search_dir(strExePath);\r
+ }\r
+#else\r
/* Add dir for openocd supplied scripts last so that user can over\r
ride those scripts if desired. */\r
add_script_search_dir(PKGDATADIR);\r
add_script_search_dir(PKGLIBDIR);\r
+#endif\r
\r
return ERROR_OK;\r
}\r