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.

56 lines
1.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. // $NoKeywords: $
  8. //===========================================================================//
  9. #include "filesystem.h"
  10. #include "dedicated.h"
  11. #include <stdio.h>
  12. #include <stdlib.h>
  13. #include "interface.h"
  14. #include <string.h>
  15. #include <malloc.h>
  16. #include "tier1/strtools.h"
  17. #include "tier0/icommandline.h"
  18. #include "tier0/dbg.h"
  19. #include "../filesystem/basefilesystem.h"
  20. #include "appframework/AppFramework.h"
  21. #include "tier2/tier2.h"
  22. extern IFileSystem *g_pFileSystem;
  23. extern IBaseFileSystem *g_pBaseFileSystem;
  24. // implement our own special factory that we don't export outside of the DLL, to stop
  25. // people being able to get a pointer to a FILESYSTEM_INTERFACE_VERSION stdio interface
  26. void* FileSystemFactory(const char *pName, int *pReturnCode)
  27. {
  28. {
  29. if ( !Q_stricmp(pName, FILESYSTEM_INTERFACE_VERSION ) )
  30. {
  31. if ( pReturnCode )
  32. {
  33. *pReturnCode = IFACE_OK;
  34. }
  35. return g_pFileSystem;
  36. }
  37. if ( !Q_stricmp(pName, BASEFILESYSTEM_INTERFACE_VERSION ) )
  38. {
  39. if ( pReturnCode )
  40. {
  41. *pReturnCode = IFACE_OK;
  42. }
  43. return g_pBaseFileSystem;
  44. }
  45. }
  46. if ( pReturnCode )
  47. {
  48. *pReturnCode = IFACE_FAILED;
  49. }
  50. return NULL;
  51. }