Use env variable USERPROFILE instead of HOME for windows and mingw.

re: https://github.com/Unidata/netcdf-c/issues/2380
re: https://github.com/Unidata/netcdf-c/issues/2337

This PARTIALLY fixes some HOME problems because under Windows,
the HOME environment variable may not be set. In that case, use the
USERPROFILE environment variable instead.
This commit is contained in:
Dennis Heimbigner 2022-06-21 14:09:10 -06:00
parent a3998aa2f0
commit 7a22b7c630

View File

@ -81,9 +81,9 @@ NCDISPATCH_initialize(void)
/* Capture $HOME */
{
#if defined(_WIN32) && !defined(__MINGW32__)
char* home = getenv("HOME");
#else
char* home = getenv("USERPROFILE");
#else
char* home = getenv("HOME");
#endif
if(home == NULL) {
/* use cwd */