From d2965024ca5eb545ce324d8d3ec70171cf97eb15 Mon Sep 17 00:00:00 2001 From: hai007 Date: Wed, 1 Mar 2023 15:17:43 -0800 Subject: [PATCH] Move app data from %PROGRAMDATA% to %LOCALAPPDATA% PiperOrigin-RevId: 513355549 --- internal/platform/implementation/windows/device_info.cc | 2 +- internal/platform/implementation/windows/platform.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/platform/implementation/windows/device_info.cc b/internal/platform/implementation/windows/device_info.cc index e0232355..b05e5751 100644 --- a/internal/platform/implementation/windows/device_info.cc +++ b/internal/platform/implementation/windows/device_info.cc @@ -387,7 +387,7 @@ std::optional DeviceInfo::GetTemporaryPath() const { std::optional DeviceInfo::GetLogPath() const { PWSTR path; - HRESULT result = SHGetKnownFolderPath(FOLDERID_ProgramData, KF_FLAG_DEFAULT, + HRESULT result = SHGetKnownFolderPath(FOLDERID_LocalAppData, KF_FLAG_DEFAULT, /*hToken=*/nullptr, &path); if (result == S_OK) { std::filesystem::path prefixPath = path; diff --git a/internal/platform/implementation/windows/platform.cc b/internal/platform/implementation/windows/platform.cc index 200edf7f..10edeca1 100644 --- a/internal/platform/implementation/windows/platform.cc +++ b/internal/platform/implementation/windows/platform.cc @@ -134,8 +134,8 @@ std::string ImplementationPlatform::GetAppDataPath( // KNOWNFOLDERID. // https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderpath SHGetKnownFolderPath( - FOLDERID_ProgramData, // rfid: A reference to the KNOWNFOLDERID that - // identifies the folder. + FOLDERID_LocalAppData, // rfid: A reference to the KNOWNFOLDERID that + // identifies the folder. 0, // dwFlags: Flags that specify special retrieval options. NULL, // hToken: An access token that represents a particular user. &basePath); // ppszPath: When this method returns, contains the address