main.c, add USERPROFILE to search path for .spiceinit

search sequence: current directory, HOME, USERPROFILE
This commit is contained in:
h_vogt 2017-08-12 18:27:11 +02:00
parent 3814201d13
commit 060e0037f8
1 changed files with 12 additions and 2 deletions

View File

@ -1141,11 +1141,21 @@ main(int argc, char **argv)
/* if that failed try in the user's home directory
if their HOME environment variable is set */
char *homedir = getenv("HOME");
if (homedir)
if (FALSE == read_initialisation_file(homedir, INITSTR) &&
if (homedir) {
if (FALSE == read_initialisation_file(homedir, INITSTR) &&
FALSE == read_initialisation_file(homedir, ALT_INITSTR)) {
;
}
}
else {
/* If there is no HOME environment (e.g. MS Windows), try user's profile directory */
homedir = getenv("USERPROFILE");
if (homedir)
if (FALSE == read_initialisation_file(homedir, INITSTR) &&
FALSE == read_initialisation_file(homedir, ALT_INITSTR)) {
;
}
}
}
}