Look in current dir for game library

This commit is contained in:
Simon 2023-08-12 20:19:47 +01:00
parent d28bd8aa9c
commit 572ae3f340
3 changed files with 27 additions and 0 deletions

View file

@ -646,7 +646,10 @@ void *Sys_LoadGameDll( const char *name, GetModuleAPIProc **moduleAPI )
char *apppath = Cvar_VariableString( "fs_apppath" );
#endif
const char* current_dir = Sys_CurrentDirname();
const char *searchPaths[] = {
current_dir,
homepath,
#ifdef MACOS_X
apppath,

View file

@ -143,6 +143,7 @@ char *Sys_DefaultAppPath(void);
char *Sys_DefaultHomePath(void);
const char *Sys_Dirname( char *path );
const char *Sys_Basename( char *path );
const char * Sys_CurrentDirname();
bool Sys_PathCmp( const char *path1, const char *path2 );

View file

@ -25,6 +25,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include <io.h>
#include <shlobj.h>
#include <windows.h>
#include <winbase.h>
#define MEM_THRESHOLD (128*1024*1024)
@ -84,6 +85,28 @@ const char *Sys_Dirname( char *path )
return dir;
}
/*
==============
Sys_Dirname
==============
*/
const char *Sys_CurrentDirname( )
{
static char dir[ MAX_OSPATH ] = { 0 };
GetCurrentDirectory(
MAX_OSPATH,
dir
);
while( length > 0 && dir[ length ] != '\\' )
length--;
dir[ length ] = '\0';
return dir;
}
/*
================
Sys_Milliseconds