Skip to content

Commit a79cb43

Browse files
authored
Get home path on Windows from USERPROFILE env var (#1527)
Some Windows distributions have no HOMEDRIVE or/and HOMEPATH vars set by default. They have USERPROFILE variable instead. Relates-To: OCMAM-115 Signed-off-by: Mykola Malik <ext-mykola.malik@here.com>
1 parent 3e8c222 commit a79cb43

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

olp-cpp-sdk-authentication/src/AuthenticationCredentials.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019-2023 HERE Europe B.V.
2+
* Copyright (C) 2019-2024 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,6 +34,10 @@ const std::string kHereTokenEndpointUrl = "here.token.endpoint.url";
3434
std::string GetDefaultPath() {
3535
const char* env;
3636
#ifdef _WIN32
37+
if ((env = std::getenv("USERPROFILE")) != nullptr) {
38+
return std::string(env).append("\\.here\\credentials.properties");
39+
}
40+
3741
if ((env = std::getenv("HOMEDRIVE")) != nullptr) {
3842
std::string path{env};
3943

0 commit comments

Comments
 (0)