[quake3-commits] r1626 - in trunk/code: qcommon sys
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Tue Sep 15 02:32:05 EDT 2009
Author: icculus
Date: 2009-09-15 02:32:05 -0400 (Tue, 15 Sep 2009)
New Revision: 1626
Modified:
trunk/code/qcommon/files.c
trunk/code/qcommon/qcommon.h
trunk/code/sys/sys_main.c
Log:
Let a separate libdir be specified for loading libraries.
Partially fixes Bugzilla #4271.
Modified: trunk/code/qcommon/files.c
===================================================================
--- trunk/code/qcommon/files.c 2009-09-15 06:30:00 UTC (rev 1625)
+++ trunk/code/qcommon/files.c 2009-09-15 06:32:05 UTC (rev 1626)
@@ -241,6 +241,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;
@@ -2761,6 +2762,8 @@
fs_debug = Cvar_Get( "fs_debug", "0", 0 );
fs_basepath = Cvar_Get ("fs_basepath", Sys_DefaultInstallPath(), CVAR_INIT );
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;
Modified: trunk/code/qcommon/qcommon.h
===================================================================
--- trunk/code/qcommon/qcommon.h 2009-09-15 06:30:00 UTC (rev 1625)
+++ trunk/code/qcommon/qcommon.h 2009-09-15 06:32:05 UTC (rev 1626)
@@ -1079,6 +1079,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_Dirname( char *path );
Modified: trunk/code/sys/sys_main.c
===================================================================
--- trunk/code/sys/sys_main.c 2009-09-15 06:30:00 UTC (rev 1625)
+++ trunk/code/sys/sys_main.c 2009-09-15 06:32:05 UTC (rev 1626)
@@ -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
=================
*/
@@ -384,6 +408,7 @@
#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 (*dllEntry)( intptr_t (*syscallptr)(intptr_t, ...) );
char fname[MAX_OSPATH];
char *basepath;
+ char *libpath;
char *homepath;
char *pwdpath;
char *gamedir;
@@ -405,6 +431,7 @@
// 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 @@
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 @@
# 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 @@
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++ )
More information about the quake3-commits
mailing list