--- code/qcommon/files.c.orig 2011-03-10 02:01:27.599036000 +0100 +++ code/qcommon/files.c 2011-03-19 22:40:42.000000000 +0100 @@ -250,6 +250,7 @@ #endif static cvar_t *fs_basepath; +static cvar_t *fs_libpath; static cvar_t *fs_basegame; static cvar_t *fs_gamedirvar; static searchpath_t *fs_searchpaths; @@ -2956,6 +2957,7 @@ fs_debug = Cvar_Get( "fs_debug", "0", 0 ); fs_basepath = Cvar_Get ("fs_basepath", Sys_DefaultInstallPath(), CVAR_INIT|CVAR_PROTECTED ); fs_basegame = Cvar_Get ("fs_basegame", "", CVAR_INIT ); + fs_libpath = Cvar_Get ("fs_libpath", Sys_DefaultLibPath(), CVAR_INIT ); homePath = Sys_DefaultHomePath(); if (!homePath || !homePath[0]) { homePath = fs_basepath->string; @@ -2975,6 +2977,11 @@ if (fs_apppath->string[0]) FS_AddGameDirectory(fs_apppath->string, gameName); #endif + + // Search default library location if given + if (fs_libpath->string[0]) { + FS_AddGameDirectory ( fs_libpath->string, gameName ); + } // NOTE: same filtering below for mods and basegame if (fs_homepath->string[0] && Q_stricmp(fs_homepath->string,fs_basepath->string)) { --- code/qcommon/qcommon.h.orig 2011-03-10 02:01:27.599036000 +0100 +++ code/qcommon/qcommon.h 2011-03-19 22:40:42.000000000 +0100 @@ -1104,6 +1104,9 @@ char *Sys_DefaultAppPath(void); #endif +void Sys_SetDefaultLibPath(const char *path); +char *Sys_DefaultLibPath(void); + void Sys_SetDefaultHomePath(const char *path); char *Sys_DefaultHomePath(void); const char *Sys_TempPath(void); --- code/sys/sys_main.c.orig 2011-02-23 17:17:09.009063000 +0100 +++ code/sys/sys_main.c 2011-03-19 22:40:42.000000000 +0100 @@ -49,6 +49,7 @@ static char binaryPath[ MAX_OSPATH ] = { 0 }; static char installPath[ MAX_OSPATH ] = { 0 }; +static char libPath[ MAX_OSPATH ] = { 0 }; /* ================= @@ -95,6 +96,29 @@ /* ================= +Sys_SetDefaultLibPath +================= +*/ +void Sys_SetDefaultLibPath(const char *path) +{ + Q_strncpyz(libPath, path, sizeof(libPath)); +} + +/* +================= +Sys_DefaultLibPath +================= +*/ +char *Sys_DefaultLibPath(void) +{ + if (*libPath) + return libPath; + else + return Sys_Cwd(); +} + +/* +================= Sys_DefaultAppPath ================= */ @@ -490,6 +514,14 @@ # endif #endif +#ifndef DEFAULT_LIBDIR +# ifdef MACOS_X +# define DEFAULT_LIBDIR Sys_StripAppBundle(Sys_BinaryPath()) +# else +# define DEFAULT_LIBDIR Sys_BinaryPath() +# endif +#endif + /* ================= Sys_SigHandler @@ -564,6 +596,7 @@ Sys_ParseArgs( argc, argv ); Sys_SetBinaryPath( Sys_Dirname( argv[ 0 ] ) ); Sys_SetDefaultInstallPath( DEFAULT_BASEDIR ); + Sys_SetDefaultLibPath( DEFAULT_LIBDIR ); // Concatenate the command line for passing to Com_Init for( i = 1; i < argc; i++ )