add search in current directory

Patch provided by Uros Platise
https://sourceforge.net/p/ngspice/ngspice/merge-requests/4/
This commit is contained in:
Holger Vogt 2018-08-04 18:39:24 +02:00
parent 7c90004921
commit 19596f0f42
1 changed files with 16 additions and 1 deletions

View File

@ -1228,7 +1228,22 @@ inp_pathresolve_at(char *name, char *dir)
}
}
/* concatenate them */
/*
* Try in current dir and then in the actual dir the file was read.
* Current dir . is needed to correctly support absolute paths in sourcepath
*/
strcpy(buf, ".");
end = strchr(buf, '\0');
if (end[-1] != DIR_TERM)
*end++ = DIR_TERM;
strcpy(end, name);
char *r = inp_pathresolve(buf);
if (r)
return r;
strcpy(buf, dir);