use _wgetenv to get windows env variables

This commit is contained in:
Shelley Vohr 2017-10-25 10:40:38 -04:00
parent 042f84140d
commit 1e8bdc15e2
No known key found for this signature in database
GPG key ID: F13993A75599653C

View file

@ -168,7 +168,9 @@ BrowserMainParts::~BrowserMainParts() {
void OverrideAppLogsPath() {
#if defined(OS_WIN)
std::wstring app_name = base::UTF8ToWide(GetApplicationName());
std::wstring log_path = L"%HOMEDRIVE%%HOMEPATH%\\AppData\\Roaming\\";
std::wstring drive = _wgetenv(L"HOMEDRIVE"));
std::wstring path = _wgetenv(L"HOMEPATH"));
std::wstring log_path = drive + "\\" + path + L"\\AppData\\Roaming\\";
std::wstring app_log_path = log_path + app_name + L"\\logs";
#else
std::string app_name = GetApplicationName();