From 060e0037f8354d56e12a678dfb5578c2131f94ed Mon Sep 17 00:00:00 2001 From: h_vogt Date: Sat, 12 Aug 2017 18:27:11 +0200 Subject: [PATCH] main.c, add USERPROFILE to search path for .spiceinit search sequence: current directory, HOME, USERPROFILE --- src/main.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index b46d20822..f9faba647 100644 --- a/src/main.c +++ b/src/main.c @@ -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)) { + ; + } + } } }