PhysFSFileProvider.lua 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. class "PhysFSFileProvider"
  2. function PhysFSFileProvider:PhysFSFileProvider(...)
  3. local arg = {...}
  4. for k,v in pairs(arg) do
  5. if type(v) == "table" then
  6. if v.__ptr ~= nil then
  7. arg[k] = v.__ptr
  8. end
  9. end
  10. end
  11. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  12. self.__ptr = Polycore.PhysFSFileProvider(unpack(arg))
  13. end
  14. end
  15. function PhysFSFileProvider:openFile(fileName, opts)
  16. local retVal = Polycore.PhysFSFileProvider_openFile(self.__ptr, fileName, opts)
  17. if retVal == nil then return nil end
  18. local __c = _G["Polycode::CoreFile"]("__skip_ptr__")
  19. __c.__ptr = retVal
  20. return __c
  21. end
  22. function PhysFSFileProvider:closeFile(file)
  23. local retVal = Polycore.PhysFSFileProvider_closeFile(self.__ptr, file.__ptr)
  24. end
  25. function PhysFSFileProvider:parseFolder(pathString, showHidden, targetVector)
  26. local retVal = Polycore.PhysFSFileProvider_parseFolder(self.__ptr, pathString, showHidden, targetVector.__ptr)
  27. return retVal
  28. end
  29. function PhysFSFileProvider:addSource(source)
  30. local retVal = Polycore.PhysFSFileProvider_addSource(self.__ptr, source)
  31. end
  32. function PhysFSFileProvider:removeSource(source)
  33. local retVal = Polycore.PhysFSFileProvider_removeSource(self.__ptr, source)
  34. end
  35. function PhysFSFileProvider:__delete()
  36. if self then Polycore.delete_PhysFSFileProvider(self.__ptr) end
  37. end