mirror of
https://github.com/ioquake/ioq3.git
synced 2024-11-10 07:11:46 +00:00
Improve setting Microsoft Store path
Respect configured Program Files directory and use MSSTORE_PATH for the directory name.
This commit is contained in:
parent
d1d5a89aad
commit
fe7325be29
1 changed files with 30 additions and 1 deletions
|
@ -235,7 +235,36 @@ char* Sys_MicrosoftStorePath(void)
|
|||
#ifdef MSSTORE_PATH
|
||||
if (!microsoftStorePath[0])
|
||||
{
|
||||
Q_strcat(microsoftStorePath, MAX_OSPATH, "C:\\Program Files\\ModifiableWindowsApps\\Quake 3\\EN");
|
||||
TCHAR szPath[MAX_PATH];
|
||||
FARPROC qSHGetFolderPath;
|
||||
HMODULE shfolder = LoadLibrary("shfolder.dll");
|
||||
|
||||
if(shfolder == NULL)
|
||||
{
|
||||
Com_Printf("Unable to load SHFolder.dll\n");
|
||||
return microsoftStorePath;
|
||||
}
|
||||
|
||||
qSHGetFolderPath = GetProcAddress(shfolder, "SHGetFolderPathA");
|
||||
if(qSHGetFolderPath == NULL)
|
||||
{
|
||||
Com_Printf("Unable to find SHGetFolderPath in SHFolder.dll\n");
|
||||
FreeLibrary(shfolder);
|
||||
return microsoftStorePath;
|
||||
}
|
||||
|
||||
if( !SUCCEEDED( qSHGetFolderPath( NULL, CSIDL_PROGRAM_FILES,
|
||||
NULL, 0, szPath ) ) )
|
||||
{
|
||||
Com_Printf("Unable to detect CSIDL_PROGRAM_FILES\n");
|
||||
FreeLibrary(shfolder);
|
||||
return microsoftStorePath;
|
||||
}
|
||||
|
||||
FreeLibrary(shfolder);
|
||||
|
||||
// default: C:\Program Files\ModifiableWindowsApps\Quake 3\EN
|
||||
Com_sprintf(microsoftStorePath, sizeof(microsoftStorePath), "%s%cModifiableWindowsApps%c%s%cEN", szPath, PATH_SEP, PATH_SEP, MSSTORE_PATH, PATH_SEP);
|
||||
}
|
||||
#endif
|
||||
return microsoftStorePath;
|
||||
|
|
Loading…
Reference in a new issue