diff options
Diffstat (limited to 'win32/win32.c')
-rw-r--r-- | win32/win32.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/win32/win32.c b/win32/win32.c index bf96439c47..80fb30de43 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -622,21 +622,24 @@ init_env(void) if (!GetEnvironmentVariableW(L"HOME", env, numberof(env))) { f = FALSE; - if (GetEnvironmentVariableW(L"HOMEDRIVE", env, numberof(env))) - len = lstrlenW(env); - else - len = 0; - if (GetEnvironmentVariableW(L"HOMEPATH", env + len, numberof(env) - len) || len) { - f = TRUE; - } - else if (GetEnvironmentVariableW(L"USERPROFILE", env, numberof(env))) { + if (GetEnvironmentVariableW(L"USERPROFILE", env, numberof(env))) { f = TRUE; } - else if (get_special_folder(CSIDL_PROFILE, env, numberof(env))) { - f = TRUE; - } - else if (get_special_folder(CSIDL_PERSONAL, env, numberof(env))) { - f = TRUE; + else { + if (GetEnvironmentVariableW(L"HOMEDRIVE", env, numberof(env))) + len = lstrlenW(env); + else + len = 0; + + if (GetEnvironmentVariableW(L"HOMEPATH", env + len, numberof(env) - len) || len) { + f = TRUE; + } + else if (get_special_folder(CSIDL_PROFILE, env, numberof(env))) { + f = TRUE; + } + else if (get_special_folder(CSIDL_PERSONAL, env, numberof(env))) { + f = TRUE; + } } if (f) { regulate_path(env); |