Search for mods in steam path as well as home and base paths.

This commit is contained in:
SmileTheory 2015-09-25 04:52:17 -07:00
parent e0b58abf53
commit 3bd7a8d842

View file

@ -2502,6 +2502,8 @@ int FS_GetModList( char *listbuf, int bufsize ) {
int dummy; int dummy;
char **pFiles0 = NULL; char **pFiles0 = NULL;
char **pFiles1 = NULL; char **pFiles1 = NULL;
char **pFiles2 = NULL;
char **pFiles3 = NULL;
qboolean bDrop = qfalse; qboolean bDrop = qfalse;
*listbuf = 0; *listbuf = 0;
@ -2509,9 +2511,12 @@ int FS_GetModList( char *listbuf, int bufsize ) {
pFiles0 = Sys_ListFiles( fs_homepath->string, NULL, NULL, &dummy, qtrue ); pFiles0 = Sys_ListFiles( fs_homepath->string, NULL, NULL, &dummy, qtrue );
pFiles1 = Sys_ListFiles( fs_basepath->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 // we searched for mods in the three paths
// it is likely that we have duplicate names now, which we will cleanup below // 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); nPotential = Sys_CountFileList(pFiles);
for ( i = 0 ; i < nPotential ; i++ ) { for ( i = 0 ; i < nPotential ; i++ ) {
@ -2553,6 +2558,15 @@ int FS_GetModList( char *listbuf, int bufsize ) {
Sys_FreeFileList( pPaks ); 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) { if (nPaks > 0) {
nLen = strlen(name) + 1; nLen = strlen(name) + 1;
// nLen is the length of the mod path // nLen is the length of the mod path
@ -3320,6 +3334,9 @@ static void FS_Startup( const char *gameName )
// check for additional base game so mods can be based upon other mods // 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_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]) { if (fs_basepath->string[0]) {
FS_AddGameDirectory(fs_basepath->string, fs_basegame->string); FS_AddGameDirectory(fs_basepath->string, fs_basegame->string);
} }
@ -3330,6 +3347,9 @@ static void FS_Startup( const char *gameName )
// check for additional game folder for mods // check for additional game folder for mods
if ( fs_gamedirvar->string[0] && Q_stricmp( fs_gamedirvar->string, gameName ) ) { 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]) { if (fs_basepath->string[0]) {
FS_AddGameDirectory(fs_basepath->string, fs_gamedirvar->string); FS_AddGameDirectory(fs_basepath->string, fs_gamedirvar->string);
} }