[tool_parsecfg]: check HOME and USERPROFILE on all platforms in order

This commit is contained in:
Max Bossing 2025-08-09 17:28:41 +02:00
parent fdf6b5d4ef
commit 54474a7238
No known key found for this signature in database
GPG key ID: E2E95E80A0C1217E

View file

@ -209,11 +209,13 @@ int parseconfig(const char *filename)
/* expand tilde-characters to the users home directory */
if(param && param[0] == '~') {
#ifdef _WIN32
const char *home = curl_getenv("UserProfile");
#else
const char *home = curl_getenv("HOME");
#endif
char *home = curl_getenv("HOME");
if(!home)
home = curl_getenv("USERPROFILE");
if(!home) {
rc = 1; /* cannot find home */
break;
}
if(home) {
char *tparam = strdup(param + 1);
if(!tparam) {