summaryrefslogtreecommitdiff
path: root/src/sys
diff options
context:
space:
mode:
Diffstat (limited to 'src/sys')
-rw-r--r--src/sys/sys_win32.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/sys/sys_win32.c b/src/sys/sys_win32.c
index e3a550d7..abb38b78 100644
--- a/src/sys/sys_win32.c
+++ b/src/sys/sys_win32.c
@@ -91,15 +91,15 @@ char *Sys_DefaultHomePath( void )
TCHAR szPath[MAX_PATH];
FARPROC qSHGetFolderPath;
HMODULE shfolder = LoadLibrary("shfolder.dll");
-
- if(!*homePath && com_homepath)
+
+ if(shfolder == NULL)
{
- if(shfolder == NULL)
- {
- Com_Printf("Unable to load SHFolder.dll\n");
- return NULL;
- }
+ Com_Printf("Unable to load SHFolder.dll\n");
+ return NULL;
+ }
+ if(!*homePath && com_homepath)
+ {
qSHGetFolderPath = GetProcAddress(shfolder, "SHGetFolderPathA");
if(qSHGetFolderPath == NULL)
{
@@ -115,11 +115,16 @@ char *Sys_DefaultHomePath( void )
FreeLibrary(shfolder);
return NULL;
}
- Q_strncpyz( homePath, szPath, sizeof( homePath ) );
- Q_strcat( homePath, sizeof( homePath ), "\\" HOMEPATH_NAME_WIN );
- FreeLibrary(shfolder);
+
+ Com_sprintf(homePath, sizeof(homePath), "%s%c", szPath, PATH_SEP);
+
+ if(com_homepath->string[0])
+ Q_strcat(homePath, sizeof(homePath), com_homepath->string);
+ else
+ Q_strcat(homePath, sizeof(homePath), HOMEPATH_NAME_WIN);
}
+ FreeLibrary(shfolder);
return homePath;
}