diff --git a/ChangeLog b/ChangeLog index 92f5fe54e..9ec7f3cfb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-12-19 Holger Vogt + * main.c, inpcom.c: source file path added as additional search path for + opening .include files (MS Windows only). + 2009-12-17 Dietmar Warning * devices/bsim3/b3set.c: add the ngspice specific copyNodesets approach and remove the tnom celsius -> kelvin transformation diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 17392f465..b717e2b6f 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -163,16 +163,39 @@ readline(FILE *fd) /*-------------------------------------------------------------------------* - * Look up the variable sourcepath and try everything in the list in order * - * if the file isn't in . and it isn't an abs path name. * + Look up the variable sourcepath and try everything in the list in order + if the file isn't in . and it isn't an abs path name. + For MS Windows: First try the path of the source file. *-------------------------------------------------------------------------*/ FILE * inp_pathopen(char *name, char *mode) { FILE *fp; - char buf[BSIZE_SP]; + char buf[BSIZE_SP], buf2[BSIZE_SP]; struct variable *v; +#if defined(HAS_WINDOWS) + /* search in the path where the source (input) file has been found, + but only if "name" is just a file name */ + if (!(index(name, DIR_TERM)) && cp_getvar("sourcefile", VT_STRING, buf2)) { + /* If pathname is found, get path. + (char *dirname(const char *name) might have been used here) */ + if (substring(DIR_PATHSEP, buf2)) { + int i,j=0; + for (i=0; i