Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: A higher level link library for general use in the game and tools.
  4. //
  5. //===========================================================================//
  6. #include <tier0/platform.h>
  7. #include <tier2/tier2.h>
  8. #include <filesystem_init.h>
  9. static CSysModule *g_pFullFileSystemModule = NULL;
  10. void* DefaultCreateInterfaceFn(const char *pName, int *pReturnCode)
  11. {
  12. if ( pReturnCode )
  13. {
  14. *pReturnCode = 0;
  15. }
  16. return NULL;
  17. }
  18. void InitDefaultFileSystem( void )
  19. {
  20. AssertMsg( !g_pFullFileSystem, "Already set up the file system" );
  21. if ( !Sys_LoadInterface( "filesystem_stdio", FILESYSTEM_INTERFACE_VERSION,
  22. &g_pFullFileSystemModule, (void**)&g_pFullFileSystem ) )
  23. {
  24. if ( !Sys_LoadInterface( "filesystem_steam", FILESYSTEM_INTERFACE_VERSION,
  25. &g_pFullFileSystemModule, (void**)&g_pFullFileSystem ) )
  26. {
  27. exit(0);
  28. }
  29. }
  30. if ( !g_pFullFileSystem->Connect( DefaultCreateInterfaceFn ) )
  31. {
  32. exit(0);
  33. }
  34. if ( g_pFullFileSystem->Init() != INIT_OK )
  35. {
  36. exit(0);
  37. }
  38. g_pFullFileSystem->RemoveAllSearchPaths();
  39. g_pFullFileSystem->AddSearchPath( "", "LOCAL", PATH_ADD_TO_HEAD );
  40. }
  41. void ShutdownDefaultFileSystem(void)
  42. {
  43. AssertMsg( g_pFullFileSystem, "File system not set up" );
  44. g_pFullFileSystem->Shutdown();
  45. g_pFullFileSystem->Disconnect();
  46. Sys_UnloadModule( g_pFullFileSystemModule );
  47. }