Add global/common user folder for Windows (#2589)

* Add global windows user folder

* Add button for creating portable folder

* Add notice about restarting after creating the portable folder

---------

Co-authored-by: rainmakerv2 <30595646+jpau02@users.noreply.github.com>
This commit is contained in:
rainmakerv2 2025-03-04 18:25:42 +08:00 committed by GitHub
parent c2adaf41c0
commit a4b35f275c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 92 additions and 17 deletions

View file

@ -17,6 +17,8 @@
#ifdef _WIN32
// This is the maximum number of UTF-16 code units permissible in Windows file paths
#define MAX_PATH 260
#include <Shlobj.h>
#include <windows.h>
#else
// This is the maximum number of UTF-8 code units permissible in all other OSes' file paths
#define MAX_PATH 1024
@ -106,6 +108,10 @@ static auto UserPaths = [] {
} else {
user_dir = std::filesystem::path(getenv("HOME")) / ".local" / "share" / "shadPS4";
}
#elif _WIN32
TCHAR appdata[MAX_PATH] = {0};
SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, appdata);
user_dir = std::filesystem::path(appdata) / "shadPS4";
#endif
}