Duane Ellis <openocd@duaneellis.com>
improve error message in Jim when sourcing a file fails. Previously it did not tell you the CWD Jim was using as its reference point. (Helpful when script filenames are a relative path) git-svn-id: svn://svn.berlios.de/openocd/trunk@840 b42882b7-edfa-0310-969c-e2dbd0fdcd60__archive__
parent
6c0553c8c5
commit
dbd6cede00
|
@ -8734,12 +8734,15 @@ int Jim_EvalFile(Jim_Interp *interp, const char *filename)
|
||||||
int nread, totread, maxlen, buflen;
|
int nread, totread, maxlen, buflen;
|
||||||
int retval;
|
int retval;
|
||||||
Jim_Obj *scriptObjPtr;
|
Jim_Obj *scriptObjPtr;
|
||||||
|
char cwd[ 2048 ];
|
||||||
|
|
||||||
if ((fp = fopen(filename, "r")) == NULL) {
|
if ((fp = fopen(filename, "r")) == NULL) {
|
||||||
Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
|
Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
|
||||||
|
getcwd( cwd, sizeof(cwd) );
|
||||||
Jim_AppendStrings(interp, Jim_GetResult(interp),
|
Jim_AppendStrings(interp, Jim_GetResult(interp),
|
||||||
"Error loading script \"", filename, "\": ",
|
"Error loading script \"", filename, "\"",
|
||||||
strerror(errno), NULL);
|
" cwd: ", cwd,
|
||||||
|
" err: ", strerror(errno), NULL);
|
||||||
return JIM_ERR;
|
return JIM_ERR;
|
||||||
}
|
}
|
||||||
buflen = 1024;
|
buflen = 1024;
|
||||||
|
|
Loading…
Reference in New Issue