r827 - trunk/code/win32

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue Aug 1 07:41:49 EDT 2006


Author: tma
Date: 2006-08-01 07:41:49 -0400 (Tue, 01 Aug 2006)
New Revision: 827

Modified:
   trunk/code/win32/win_local.h
   trunk/code/win32/win_shared.c
Log:
* Windows home directory support (tjw)


Modified: trunk/code/win32/win_local.h
===================================================================
--- trunk/code/win32/win_local.h	2006-07-31 19:05:14 UTC (rev 826)
+++ trunk/code/win32/win_local.h	2006-08-01 11:41:49 UTC (rev 827)
@@ -37,6 +37,7 @@
 #include <dsound.h>
 #include <winsock.h>
 #include <wsipx.h>
+#include <shlobj.h>
 
 void	IN_MouseEvent (int mstate);
 

Modified: trunk/code/win32/win_shared.c
===================================================================
--- trunk/code/win32/win_shared.c	2006-07-31 19:05:14 UTC (rev 826)
+++ trunk/code/win32/win_shared.c	2006-08-01 11:41:49 UTC (rev 827)
@@ -285,7 +285,26 @@
 }
 
 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)




More information about the quake3-commits mailing list