csgo-2018-source/tier2/defaultfilesystem.cpp
2021-07-24 21:11:47 -07:00

58 lines
1.4 KiB
C++

//===== Copyright © 2005-2005, Valve Corporation, All rights reserved. ======//
//
// Purpose: A higher level link library for general use in the game and tools.
//
//===========================================================================//
#include <tier0/platform.h>
#include <tier2/tier2.h>
#include <filesystem_init.h>
// NOTE: This has to be the last file included!
#include "tier0/memdbgon.h"
static CSysModule *g_pFullFileSystemModule = NULL;
void* DefaultCreateInterfaceFn(const char *pName, int *pReturnCode)
{
if ( pReturnCode )
{
*pReturnCode = 0;
}
return NULL;
}
void InitDefaultFileSystem( void )
{
AssertMsg( !g_pFullFileSystem, "Already set up the file system" );
if ( !Sys_LoadInterface( "filesystem_stdio", FILESYSTEM_INTERFACE_VERSION,
&g_pFullFileSystemModule, (void**)&g_pFullFileSystem ) )
{
exit(0);
}
if ( !g_pFullFileSystem->Connect( DefaultCreateInterfaceFn ) )
{
exit(0);
}
if ( g_pFullFileSystem->Init() != INIT_OK )
{
exit(0);
}
g_pFullFileSystem->RemoveAllSearchPaths();
g_pFullFileSystem->AddSearchPath( "", "LOCAL", PATH_ADD_TO_HEAD );
g_pFullFileSystem->AddSearchPath( "", "DEFAULT_WRITE_PATH", PATH_ADD_TO_HEAD );
}
void ShutdownDefaultFileSystem(void)
{
AssertMsg( g_pFullFileSystem, "File system not set up" );
g_pFullFileSystem->Shutdown();
g_pFullFileSystem->Disconnect();
Sys_UnloadModule( g_pFullFileSystemModule );
}