vfs: support .pk3dir like in darkplaces engine - directories auto-added to the search path
This commit is contained in:
parent
a324e1abc7
commit
e40ea7c332
|
|
@ -353,6 +353,26 @@ void InitDirectory(const char* directory, ArchiveModules& archiveModules)
|
|||
break;
|
||||
|
||||
const char *ext = strrchr (name, '.');
|
||||
|
||||
if(ext && !string_compare_nocase_upper(ext, ".pk3dir"))
|
||||
{
|
||||
if (g_numDirs == (VFS_MAXDIRS-1))
|
||||
continue;
|
||||
snprintf(g_strDirs[g_numDirs], PATH_MAX, "%s%s/", path, name);
|
||||
g_strDirs[g_numDirs][PATH_MAX] = '\0';
|
||||
FixDOSName (g_strDirs[g_numDirs]);
|
||||
AddSlash (g_strDirs[g_numDirs]);
|
||||
g_numDirs++;
|
||||
|
||||
{
|
||||
archive_entry_t entry;
|
||||
entry.name = g_strDirs[g_numDirs-1];
|
||||
entry.archive = OpenArchive(g_strDirs[g_numDirs-1]);
|
||||
entry.is_pakfile = false;
|
||||
g_archives.push_back(entry);
|
||||
}
|
||||
}
|
||||
|
||||
if ((ext == 0) || *(++ext) == '\0' || GetArchiveTable(archiveModules, ext) == 0)
|
||||
continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -195,6 +195,18 @@ void vfsInitDirectory (const char *path)
|
|||
|
||||
{
|
||||
char *ext = strrchr (dirlist, '.');
|
||||
|
||||
if(ext && !Q_stricmp(ext, ".pk3dir"))
|
||||
{
|
||||
if (g_numDirs == (VFS_MAXDIRS-1))
|
||||
continue;
|
||||
snprintf(g_strDirs[g_numDirs], PATH_MAX, "%s/%s", path, name);
|
||||
g_strDirs[g_numDirs][PATH_MAX] = '\0';
|
||||
vfsFixDOSName (g_strDirs[g_numDirs]);
|
||||
vfsAddSlash (g_strDirs[g_numDirs]);
|
||||
++g_numDirs;
|
||||
}
|
||||
|
||||
if ((ext == NULL) || (Q_stricmp (ext, ".pk3") != 0))
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef _VFS_H_
|
||||
#define _VFS_H_
|
||||
|
||||
#define VFS_MAXDIRS 8
|
||||
#define VFS_MAXDIRS 64
|
||||
|
||||
void vfsInitDirectory (const char *path);
|
||||
void vfsShutdown ();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user