summaryrefslogtreecommitdiff
path: root/src/win32
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2006-11-28 23:46:04 +0000
committerTim Angus <tim@ngus.net>2006-11-28 23:46:04 +0000
commit92905745a71578eed267f25311d7a18d49976f6d (patch)
tree5836f0a4424b938c6782190ec9c28c6be808f389 /src/win32
parent6af24abf02f1d0dedc5dbe655a37d5afc9f0646a (diff)
* Merge ioq3-989
Diffstat (limited to 'src/win32')
-rw-r--r--src/win32/win_shared.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/win32/win_shared.c b/src/win32/win_shared.c
index ca7644ba..5ed7770c 100644
--- a/src/win32/win_shared.c
+++ b/src/win32/win_shared.c
@@ -288,15 +288,32 @@ char *Sys_GetCurrentUser( void )
char *Sys_DefaultHomePath(void) {
TCHAR szPath[MAX_PATH];
static char path[MAX_OSPATH];
+ FARPROC qSHGetFolderPath;
+ HMODULE shfolder = LoadLibrary("shfolder.dll");
+
+ if(shfolder == NULL) {
+ Com_Printf("Unable to load SHFolder.dll\n");
+ return NULL;
+ }
- if( !SUCCEEDED( SHGetFolderPath( NULL, CSIDL_LOCAL_APPDATA,
- NULL, 0, szPath ) ) )
+ qSHGetFolderPath = 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,
+ NULL, 0, szPath ) ) )
+ {
+ Com_Printf("Unable to detect CSIDL_APPDATA\n");
+ FreeLibrary(shfolder);
return NULL;
}
Q_strncpyz( path, szPath, sizeof(path) );
Q_strcat( path, sizeof(path), "\\Tremulous" );
+ FreeLibrary(shfolder);
if( !CreateDirectory( path, NULL ) )
{
if( GetLastError() != ERROR_ALREADY_EXISTS )