aboutsummaryrefslogtreecommitdiffstats
path: root/code/sys
diff options
context:
space:
mode:
authoricculus <icculus@edf5b092-35ff-0310-97b2-ce42778d08ea>2009-09-15 06:32:05 +0000
committericculus <icculus@edf5b092-35ff-0310-97b2-ce42778d08ea>2009-09-15 06:32:05 +0000
commit9f15eaa7aeb735f71390e9b86bee4291d72edd44 (patch)
tree711f04699e5195a01e3824bebde0086af17a2d3b /code/sys
parentc6b984cf26aa109656433dd274d33146e44b741e (diff)
downloadioquake3-aero-9f15eaa7aeb735f71390e9b86bee4291d72edd44.tar.gz
ioquake3-aero-9f15eaa7aeb735f71390e9b86bee4291d72edd44.zip
Let a separate libdir be specified for loading libraries.
Partially fixes Bugzilla #4271. git-svn-id: svn://svn.icculus.org/quake3/trunk@1626 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/sys')
-rw-r--r--code/sys/sys_main.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/code/sys/sys_main.c b/code/sys/sys_main.c
index ff58187..56819d1 100644
--- a/code/sys/sys_main.c
+++ b/code/sys/sys_main.c
@@ -49,6 +49,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
static char binaryPath[ MAX_OSPATH ] = { 0 };
static char installPath[ MAX_OSPATH ] = { 0 };
+static char libPath[ MAX_OSPATH ] = { 0 };
/*
=================
@@ -95,6 +96,29 @@ char *Sys_DefaultInstallPath(void)
/*
=================
+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
=================
*/
@@ -384,6 +408,7 @@ Used to load a development dll instead of a virtual machine
#1 look down current path
#2 look in fs_homepath
#3 look in fs_basepath
+#4 look in fs_libpath
=================
*/
void *Sys_LoadDll( const char *name, char *fqpath ,
@@ -394,6 +419,7 @@ void *Sys_LoadDll( const char *name, char *fqpath ,
void (*dllEntry)( intptr_t (*syscallptr)(intptr_t, ...) );
char fname[MAX_OSPATH];
char *basepath;
+ char *libpath;
char *homepath;
char *pwdpath;
char *gamedir;
@@ -405,6 +431,7 @@ void *Sys_LoadDll( const char *name, char *fqpath ,
// TODO: use fs_searchpaths from files.c
pwdpath = Sys_Cwd();
basepath = Cvar_VariableString( "fs_basepath" );
+ libpath = Cvar_VariableString( "fs_libpath" );
homepath = Cvar_VariableString( "fs_homepath" );
gamedir = Cvar_VariableString( "fs_game" );
@@ -416,6 +443,9 @@ void *Sys_LoadDll( const char *name, char *fqpath ,
if(!libHandle && basepath)
libHandle = Sys_TryLibraryLoad(basepath, gamedir, fname, fqpath);
+ if(!libHandle && libpath)
+ libHandle = Sys_TryLibraryLoad(libpath, gamedir, fname, fqpath);
+
if(!libHandle) {
Com_Printf ( "Sys_LoadDll(%s) failed to load library\n", name );
return NULL;
@@ -469,6 +499,14 @@ void Sys_ParseArgs( int argc, char **argv )
# 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
@@ -538,6 +576,7 @@ int main( int argc, char **argv )
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++ )