Skip to content

Commit

Permalink
Search for mods in steam path as well as home and base paths.
Browse files Browse the repository at this point in the history
  • Loading branch information
SmileTheory committed Sep 25, 2015
1 parent e0b58ab commit 3bd7a8d
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion code/qcommon/files.c
Expand Up @@ -2502,16 +2502,21 @@ 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;
nMods = nTotal = 0;

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++ ) {
Expand Down Expand Up @@ -2553,6 +2558,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
Expand Down Expand Up @@ -3320,6 +3334,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);
}
Expand All @@ -3330,6 +3347,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);
}
Expand Down

0 comments on commit 3bd7a8d

Please sign in to comment.