Check 'User Shell Folders' (#111)

this PR is a continuation of #69
This commit is contained in:
Lion 2024-09-22 19:47:50 +02:00 committed by GitHub
commit b4949af1d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -43,11 +43,17 @@ std::string GetGamePath() {
sk = R"(SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders)";
openRes = RegOpenKeyEx(HKEY_CURRENT_USER, sk, 0, KEY_ALL_ACCESS, &hKey);
if (openRes != ERROR_SUCCESS) {
fatal("Cannot get Local Appdata directory!");
sk = R"(SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders)";
openRes = RegOpenKeyEx(HKEY_CURRENT_USER, sk, 0, KEY_ALL_ACCESS, &hKey);
}
if (openRes != ERROR_SUCCESS) {
fatal("Cannot get Local Appdata directory");
}
Path = QueryKey(hKey, 5);
Path += "\\BeamNG.drive\\";
}
std::string Ver = CheckVer(GetGameDir());
Ver = Ver.substr(0, Ver.find('.', Ver.find('.') + 1));
Path += Ver + "\\";