Call SHGetFolderPathA directly
Removing shfolder.h satisfies MSVC, and calling the function directly makes PFNSHGETFOLDERPATHA unnecessary.
This commit is contained in:
parent
4303784442
commit
934e7b9372
2
Makefile
2
Makefile
|
|
@ -668,7 +668,7 @@ ifdef MINGW
|
|||
$(call bin_path, $(TOOLS_MINGW_PREFIX)-gcc))))
|
||||
endif
|
||||
|
||||
LIBS= -lws2_32 -lwinmm -lpsapi
|
||||
LIBS= -lws2_32 -lwinmm -lpsapi -lshell32
|
||||
AUTOUPDATER_LIBS += -lwininet
|
||||
|
||||
# clang 3.4 doesn't support this
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#include <io.h>
|
||||
#include <conio.h>
|
||||
#include <wincrypt.h>
|
||||
#include <shfolder.h>
|
||||
#include <shlobj.h>
|
||||
#include <psapi.h>
|
||||
#include <float.h>
|
||||
|
|
@ -104,30 +103,14 @@ Sys_DefaultHomePath
|
|||
char *Sys_DefaultHomePath( void )
|
||||
{
|
||||
TCHAR szPath[MAX_PATH];
|
||||
PFNSHGETFOLDERPATHA qSHGetFolderPath;
|
||||
HMODULE shfolder = LoadLibrary("shfolder.dll");
|
||||
|
||||
if(shfolder == NULL)
|
||||
{
|
||||
Com_Printf("Unable to load SHFolder.dll\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(!*homePath && com_homepath)
|
||||
{
|
||||
qSHGetFolderPath = (PFNSHGETFOLDERPATHA)GetProcAddress(shfolder, "SHGetFolderPathA");
|
||||
if(qSHGetFolderPath == NULL)
|
||||
{
|
||||
Com_Printf("Unable to find SHGetFolderPath in SHFolder.dll\n");
|
||||
FreeLibrary(shfolder);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( !SUCCEEDED( qSHGetFolderPath( NULL, CSIDL_APPDATA,
|
||||
if( !SUCCEEDED( SHGetFolderPathA( NULL, CSIDL_APPDATA,
|
||||
NULL, 0, szPath ) ) )
|
||||
{
|
||||
Com_Printf("Unable to detect CSIDL_APPDATA\n");
|
||||
FreeLibrary(shfolder);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -139,7 +122,6 @@ char *Sys_DefaultHomePath( void )
|
|||
Q_strcat(homePath, sizeof(homePath), HOMEPATH_NAME_WIN);
|
||||
}
|
||||
|
||||
FreeLibrary(shfolder);
|
||||
return homePath;
|
||||
}
|
||||
|
||||
|
|
@ -240,33 +222,14 @@ char* Sys_MicrosoftStorePath(void)
|
|||
if (!microsoftStorePath[0])
|
||||
{
|
||||
TCHAR szPath[MAX_PATH];
|
||||
PFNSHGETFOLDERPATHA qSHGetFolderPath;
|
||||
HMODULE shfolder = LoadLibrary("shfolder.dll");
|
||||
|
||||
if(shfolder == NULL)
|
||||
{
|
||||
Com_Printf("Unable to load SHFolder.dll\n");
|
||||
return microsoftStorePath;
|
||||
}
|
||||
|
||||
qSHGetFolderPath = (PFNSHGETFOLDERPATHA)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,
|
||||
if( !SUCCEEDED( SHGetFolderPathA( 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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user