Search for .spiceinit (or spice.rc) firstly in a user defined directory,
when the directory path is set in the environmental variable SPICE_USERINIT_DIR. If not found then search in the current directory, then in HOME, then in USERPROFILE.
This commit is contained in:
parent
dcb3bf0f8b
commit
317e5a3d99
18
src/main.c
18
src/main.c
|
|
@ -1172,9 +1172,23 @@ int main(int argc, char **argv)
|
|||
else {
|
||||
if (readinit) {
|
||||
/* load user's initialisation file
|
||||
try accessing the initialisation file in the current directory
|
||||
if that fails try the alternate name */
|
||||
try accessing the initialisation file .spiceinit in a user provided
|
||||
path read from environmental variable SPICE_USERINIT_DIR,
|
||||
if that fails try the alternate name spice.rc, then look into
|
||||
the current directory, then the HOME directory, then into USERPROFILE */
|
||||
do {
|
||||
{
|
||||
const char* const userinit = getenv("SPICE_USERINIT_DIR");
|
||||
if (userinit) {
|
||||
if (read_initialisation_file(userinit, INITSTR) != FALSE) {
|
||||
break;
|
||||
}
|
||||
if (read_initialisation_file(userinit, ALT_INITSTR) != FALSE) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (read_initialisation_file("", INITSTR) != FALSE) {
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -927,10 +927,23 @@ ngSpice_Init(SendChar* printfcn, SendStat* statusfcn, ControlledExit* ngspiceexi
|
|||
}
|
||||
#else /* ~ HAVE_PWD_H */
|
||||
/* load user's initialisation file
|
||||
try accessing the initialisation file .spiceinit in the current directory
|
||||
if that fails try the alternate name spice.rc, then look into the HOME
|
||||
directory, then into USERPROFILE */
|
||||
try accessing the initialisation file .spiceinit in a user provided
|
||||
path read from environmental variable SPICE_USERINIT_DIR,
|
||||
if that fails try the alternate name spice.rc, then look into
|
||||
the current directory, then the HOME directory, then into USERPROFILE */
|
||||
do {
|
||||
{
|
||||
const char* const userinit = getenv("SPICE_USERINIT_DIR");
|
||||
if (userinit) {
|
||||
if (read_initialisation_file(userinit, INITSTR) != FALSE) {
|
||||
break;
|
||||
}
|
||||
if (read_initialisation_file(userinit, ALT_INITSTR) != FALSE) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (read_initialisation_file("", INITSTR) != FALSE) {
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue