From 307a4c037a17fe9752c369ace3c602a35ff5b405 Mon Sep 17 00:00:00 2001
From: "Tony J. White =" <tjw@tjw.org>
Date: Wed, 13 Sep 2006 22:55:53 +0000
Subject: [PATCH] Bug 2813 * Do not detect a seperate homepath on win95, win98,
 or winme since it's not   truly a user-specific dir and therefore provides no
 advantage * Use CSIDL_APPDATA instead of CSIDL_LOCAL_APPDATA.  This means
 that   user-specific game data is now allowed to be part of a user's Roaming
 Profile

---
 README                  | 21 +++++++++++++++++++++
 code/win32/win_shared.c | 11 +++++++++--
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/README b/README
index 0590785f..b2e5a79d 100644
--- a/README
+++ b/README
@@ -24,6 +24,8 @@ for further development. Some of the major features currently implemented are:
   * Support for various esoteric operating systems (see
     http://icculus.org/quake3/?page=status)
   * HTTP/FTP download redirection (using cURL)
+  * Multiuser support on Windows NT based systems (user specific game data
+    is stored in "%APPDATA%\Quake3")
   * Many, many bug fixes
 
 The map editor and associated compiling tools are not included. We suggest you
@@ -234,6 +236,25 @@ Using HTTP/FTP Download Support (Client)
     it will use the value of the cvar cl_cURLLib as the filename of the cURL
     library to dynamically load. 
 
+Multiuser Support on Windows NT based sysems
+    On Windows NT based systems (e.g. Windows XP), all user specific files such
+    as autogenerated configuration, demos, videos, screenshots, and
+    autodownloaded pk3s are now saved in a directory specific to the
+    user who is running ioquake3.  On systems using the English language, 
+    this is usually a directory named:
+      "C:\Documents and Settings\%USERNAME%\Application Data\Quake3\"
+
+    In order to access this directory more easily, the installer may create a
+    Shortcut which has its target set to:
+      "%APPDATA%\Quake3\"
+    Such a link would work for all users and would work on non-English versions
+    of Windows.
+    
+    You can revert to the old single-user behaviour by setting the fs_homepath
+    cvar to the directory where ioquake3 is installed.  For example:
+      ioquake3.exe +set fs_homepath "c:\ioquake3"
+    Note that this cvar MUST be set as a command line parameter.
+
 ------------------------------------------------------------- Contributing -----
 
 Please send all patches to bugzilla (https://bugzilla.icculus.org), or join the
diff --git a/code/win32/win_shared.c b/code/win32/win_shared.c
index 4bbd509d..98c00984 100644
--- a/code/win32/win_shared.c
+++ b/code/win32/win_shared.c
@@ -288,10 +288,17 @@ char	*Sys_DefaultHomePath(void) {
 	TCHAR szPath[MAX_PATH];
 	static char path[MAX_OSPATH];
 
-	if( !SUCCEEDED( SHGetFolderPath( NULL, CSIDL_LOCAL_APPDATA,
+	// do not bother using a seperate home directory on versions of
+	// windows that do not offer true per-user home directories 
+	// (win98, win95, winme)
+	g_wv.osversion.dwOSVersionInfoSize = sizeof( g_wv.osversion );
+	GetVersionEx( &g_wv.osversion );
+	if( g_wv.osversion.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
+		return NULL;
+
+	if( !SUCCEEDED( SHGetFolderPath( NULL, CSIDL_APPDATA,
 		NULL, 0, szPath ) ) )
 	{
-
 		return NULL;
 	}
 	Q_strncpyz( path, szPath, sizeof(path) );