mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-23 20:41:36 +00:00
Modlist_Init: relax tests for mod directories
Consider any subdirectories of the com_basedir as mods, except for .app bundles on posix systems. Previous code was too strict as it required progs.dat or pak files, so it excluded map packs, etc. (useful mods could contain almost anything, e.g. just a music directory, just a config...) git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@1416 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
acc84717b1
commit
b1929b32ce
1 changed files with 19 additions and 2 deletions
|
@ -230,6 +230,7 @@ void Modlist_Init (void)
|
|||
{
|
||||
WIN32_FIND_DATA fdat, mod_fdat;
|
||||
HANDLE fhnd, mod_fhnd;
|
||||
DWORD attribs;
|
||||
char dir_string[MAX_OSPATH], mod_string[MAX_OSPATH];
|
||||
|
||||
q_snprintf (dir_string, sizeof(dir_string), "%s/*", com_basedir);
|
||||
|
@ -239,9 +240,17 @@ void Modlist_Init (void)
|
|||
|
||||
do
|
||||
{
|
||||
if (!strcmp(fdat.cFileName, "."))
|
||||
if (!strcmp(fdat.cFileName, ".") || !strcmp(fdat.cFileName, ".."))
|
||||
continue;
|
||||
|
||||
#if 1
|
||||
// treat all subdirectories as mods
|
||||
q_snprintf (mod_string, sizeof(mod_string), "%s/%s", com_basedir, fdat.cFileName);
|
||||
attribs = GetFileAttributes (mod_string);
|
||||
if (attribs != INVALID_FILE_ATTRIBUTES && (attribs & FILE_ATTRIBUTE_DIRECTORY))
|
||||
{
|
||||
Modlist_Add(fdat.cFileName);
|
||||
}
|
||||
#else
|
||||
q_snprintf (mod_string, sizeof(mod_string), "%s/%s/progs.dat", com_basedir, fdat.cFileName);
|
||||
mod_fhnd = FindFirstFile(mod_string, &mod_fdat);
|
||||
if (mod_fhnd != INVALID_HANDLE_VALUE) {
|
||||
|
@ -256,6 +265,7 @@ void Modlist_Init (void)
|
|||
Modlist_Add(fdat.cFileName);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} while (FindNextFile(fhnd, &fdat));
|
||||
|
||||
FindClose(fhnd);
|
||||
|
@ -276,10 +286,13 @@ void Modlist_Init (void)
|
|||
{
|
||||
if (!strcmp(dir_t->d_name, ".") || !strcmp(dir_t->d_name, ".."))
|
||||
continue;
|
||||
if (!q_strcasecmp (COM_FileGetExtension (dir_t->d_name), "app")) // skip .app bundles on macOS
|
||||
continue;
|
||||
q_snprintf(mod_string, sizeof(mod_string), "%s%s/", dir_string, dir_t->d_name);
|
||||
mod_dir_p = opendir(mod_string);
|
||||
if (mod_dir_p == NULL)
|
||||
continue;
|
||||
#if 0
|
||||
// find progs.dat and pak file(s)
|
||||
while ((mod_dir_t = readdir(mod_dir_p)) != NULL)
|
||||
{
|
||||
|
@ -292,6 +305,10 @@ void Modlist_Init (void)
|
|||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
// don't bother testing for pak files / progs.dat
|
||||
Modlist_Add(dir_t->d_name);
|
||||
#endif
|
||||
closedir(mod_dir_p);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue