r1239 - in trunk/code: qcommon sys

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Dec 14 16:53:57 EST 2007


Author: thilo
Date: 2007-12-14 16:53:57 -0500 (Fri, 14 Dec 2007)
New Revision: 1239

Modified:
   trunk/code/qcommon/files.c
   trunk/code/qcommon/qcommon.h
   trunk/code/sys/sys_main.c
Log:
Add gamedirectory in .app to searchpath on MacOSX


Modified: trunk/code/qcommon/files.c
===================================================================
--- trunk/code/qcommon/files.c	2007-12-14 16:54:13 UTC (rev 1238)
+++ trunk/code/qcommon/files.c	2007-12-14 21:53:57 UTC (rev 1239)
@@ -234,6 +234,12 @@
 static	char		fs_gamedir[MAX_OSPATH];	// this will be a single file name with no separators
 static	cvar_t		*fs_debug;
 static	cvar_t		*fs_homepath;
+
+#ifdef MACOS_X
+// Also search the .app bundle for .pk3 files
+static  cvar_t          *fs_apppath;
+#endif
+
 static	cvar_t		*fs_basepath;
 static	cvar_t		*fs_basegame;
 static	cvar_t		*fs_gamedirvar;
@@ -2392,7 +2398,7 @@
 then loads the zip headers
 ================
 */
-static void FS_AddGameDirectory( const char *path, const char *dir ) {
+void FS_AddGameDirectory( const char *path, const char *dir ) {
 	searchpath_t	*sp;
 	int				i;
 	searchpath_t	*search;
@@ -2723,6 +2729,14 @@
 		FS_AddGameDirectory( fs_basepath->string, gameName );
 	}
 	// fs_homepath is somewhat particular to *nix systems, only add if relevant
+	
+	#ifdef MACOS_X
+	fs_apppath = Cvar_Get ("fs_apppath", Sys_DefaultAppPath(), CVAR_INIT );
+	// Make MacOSX also include the base path included with the .app bundle
+	if (fs_apppath->string[0])
+		FS_AddGameDirectory(fs_apppath->string, gameName);
+	#endif
+	
 	// NOTE: same filtering below for mods and basegame
 	if (fs_homepath->string[0] && Q_stricmp(fs_homepath->string,fs_basepath->string)) {
 		FS_AddGameDirectory ( fs_homepath->string, gameName );

Modified: trunk/code/qcommon/qcommon.h
===================================================================
--- trunk/code/qcommon/qcommon.h	2007-12-14 16:54:13 UTC (rev 1238)
+++ trunk/code/qcommon/qcommon.h	2007-12-14 21:53:57 UTC (rev 1239)
@@ -545,6 +545,8 @@
 void	FS_Restart( int checksumFeed );
 // shutdown and restart the filesystem so changes to fs_gamedir can take effect
 
+void FS_AddGameDirectory( const char *path, const char *dir );
+
 char	**FS_ListFiles( const char *directory, const char *extension, int *numfiles );
 // directory should not have either a leading or trailing /
 // if extension is "/", only subdirectories will be returned
@@ -1027,6 +1029,11 @@
 char	*Sys_Cwd( void );
 void	Sys_SetDefaultInstallPath(const char *path);
 char	*Sys_DefaultInstallPath(void);
+
+#ifdef MACOS_X
+char    *Sys_DefaultAppPath(void);
+#endif
+
 void  Sys_SetDefaultHomePath(const char *path);
 char	*Sys_DefaultHomePath(void);
 const char *Sys_Dirname( char *path );

Modified: trunk/code/sys/sys_main.c
===================================================================
--- trunk/code/sys/sys_main.c	2007-12-14 16:54:13 UTC (rev 1238)
+++ trunk/code/sys/sys_main.c	2007-12-14 21:53:57 UTC (rev 1239)
@@ -95,6 +95,16 @@
 
 /*
 =================
+Sys_DefaultAppPath
+=================
+*/
+char *Sys_DefaultAppPath(void)
+{
+	return Sys_BinaryPath();
+}
+
+/*
+=================
 Sys_In_Restart_f
 
 Restart the input subsystem




More information about the quake3-commits mailing list