diff options
author | SmileTheory <SmileTheory@gmail.com> | 2015-09-25 04:52:17 -0700 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2016-04-07 11:09:46 +0100 |
commit | 8c0a10af38306b585ae2a5dd2456a37647e9bb02 (patch) | |
tree | 29206d0b64034546008725c0f7ec44e09b2caec7 | |
parent | 5700900c3ffeb3ddaa58ddf6984e89e698f54afc (diff) |
Search for mods in steam path as well as home and base paths.
-rw-r--r-- | src/qcommon/files.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/qcommon/files.c b/src/qcommon/files.c index ab2358d8..02235bcf 100644 --- a/src/qcommon/files.c +++ b/src/qcommon/files.c @@ -2448,6 +2448,8 @@ int FS_GetModList( char *listbuf, int bufsize ) { int dummy; char **pFiles0 = NULL; char **pFiles1 = NULL; + char **pFiles2 = NULL; + char **pFiles3 = NULL; qboolean bDrop = qfalse; *listbuf = 0; @@ -2455,9 +2457,12 @@ int FS_GetModList( char *listbuf, int bufsize ) { pFiles0 = Sys_ListFiles( fs_homepath->string, NULL, NULL, &dummy, qtrue ); pFiles1 = Sys_ListFiles( fs_basepath->string, NULL, NULL, &dummy, qtrue ); + pFiles2 = Sys_ListFiles( fs_steampath->string, NULL, NULL, &dummy, qtrue ); // we searched for mods in the three paths // it is likely that we have duplicate names now, which we will cleanup below - pFiles = Sys_ConcatenateFileLists( pFiles0, pFiles1 ); + pFiles3 = Sys_ConcatenateFileLists( pFiles0, pFiles1 ); + pFiles = Sys_ConcatenateFileLists( pFiles2, pFiles3 ); + nPotential = Sys_CountFileList(pFiles); for ( i = 0 ; i < nPotential ; i++ ) { @@ -2499,6 +2504,15 @@ int FS_GetModList( char *listbuf, int bufsize ) { Sys_FreeFileList( pPaks ); } + /* try on steam path */ + if ( nPaks <= 0 ) + { + path = FS_BuildOSPath( fs_steampath->string, name, "" ); + nPaks = 0; + pPaks = Sys_ListFiles( path, ".pk3", NULL, &nPaks, qfalse ); + Sys_FreeFileList( pPaks ); + } + if (nPaks > 0) { nLen = strlen(name) + 1; // nLen is the length of the mod path @@ -3227,6 +3241,9 @@ static void FS_Startup( const char *gameName ) // check for additional base game so mods can be based upon other mods if ( fs_basegame->string[0] && Q_stricmp( fs_basegame->string, gameName ) ) { + if (fs_steampath->string[0]) { + FS_AddGameDirectory(fs_steampath->string, fs_basegame->string); + } if (fs_basepath->string[0]) { FS_AddGameDirectory(fs_basepath->string, fs_basegame->string); } @@ -3237,6 +3254,9 @@ static void FS_Startup( const char *gameName ) // check for additional game folder for mods if ( fs_gamedirvar->string[0] && Q_stricmp( fs_gamedirvar->string, gameName ) ) { + if (fs_steampath->string[0]) { + FS_AddGameDirectory(fs_steampath->string, fs_gamedirvar->string); + } if (fs_basepath->string[0]) { FS_AddGameDirectory(fs_basepath->string, fs_gamedirvar->string); } |