filesystem: archive mounting refactoring

This commit is contained in:
Alibek Omarov
2025-04-28 22:27:16 +03:00
parent 43364ec2e9
commit d457d7d093
3 changed files with 79 additions and 53 deletions

View File

@@ -470,19 +470,11 @@ public:
bool AddPackFile( const char *path, const char *id ) override
{
char dir[MAX_VA_STRING], fullpath[MAX_VA_STRING];
const char *ext = COM_FileExtension( path );
IdToDir( dir, sizeof( dir ), id );
Q_snprintf( fullpath, sizeof( fullpath ), "%s/%s", dir, path );
COM_FixSlashes( fullpath );
for( const fs_archive_t *archive = g_archives; archive->ext; archive++ )
{
if( archive->type == SEARCHPATH_PAK && !Q_stricmp( ext, archive->ext ))
return FS_AddArchive_Fullpath( archive, fullpath, FS_CUSTOM_PATH );
}
return false;
return FS_MountArchive_Fullpath( fullpath, FS_CUSTOM_PATH ) != NULL;
}
FileHandle_t OpenFromCacheForRead( const char *path , const char *mode, const char *id ) override