From 635e8bc32678e179eb9b2675adb26c3f63ce5cf0 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Tue, 1 Aug 2006 11:41:49 +0000 Subject: [PATCH] * Windows home directory support (tjw) --- code/win32/win_local.h | 1 + code/win32/win_shared.c | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/code/win32/win_local.h b/code/win32/win_local.h index fdca55a2..14c0de5b 100644 --- a/code/win32/win_local.h +++ b/code/win32/win_local.h @@ -37,6 +37,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include #include +#include void IN_MouseEvent (int mstate); diff --git a/code/win32/win_shared.c b/code/win32/win_shared.c index fe75e3aa..36a35c52 100644 --- a/code/win32/win_shared.c +++ b/code/win32/win_shared.c @@ -285,7 +285,26 @@ char *Sys_GetCurrentUser( void ) } char *Sys_DefaultHomePath(void) { - return NULL; + TCHAR szPath[MAX_PATH]; + static char path[MAX_OSPATH]; + + if( !SUCCEEDED( SHGetFolderPath( NULL, CSIDL_LOCAL_APPDATA, + NULL, 0, szPath ) ) ) + { + + return NULL; + } + Q_strncpyz( path, szPath, sizeof(path) ); + Q_strcat( path, sizeof(path), "\\Quake3" ); + if( CreateDirectory( path, NULL ) ) + { + if( GetLastError() != ERROR_ALREADY_EXISTS ) + { + Com_Printf("Unable to create directory \"%s\"\n", path); + return NULL; + } + } + return path; } char *Sys_DefaultInstallPath(void)