FileSystem.pkg 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. $#include "FileSystem.h"
  2. static const unsigned SCAN_FILES;
  3. static const unsigned SCAN_DIRS;
  4. static const unsigned SCAN_HIDDEN;
  5. class FileSystem : public Object
  6. {
  7. bool SetCurrentDir(const String pathName);
  8. bool CreateDir(const String pathName);
  9. int SystemCommand(const String commandLine);
  10. int SystemRun(const String fileName, const Vector<String>& arguments);
  11. bool SystemOpen(const String fileName, const String mode = String::EMPTY);
  12. bool Copy(const String srcFileName, const String destFileName);
  13. bool Rename(const String srcFileName, const String destFileName);
  14. bool Delete(const String fileName);
  15. void RegisterPath(const String pathName);
  16. String GetCurrentDir() const;
  17. bool HasRegisteredPaths() const;
  18. bool CheckAccess(const String pathName) const;
  19. unsigned GetLastModifiedTime(const String fileName) const;
  20. bool FileExists(const String fileName) const;
  21. bool DirExists(const String pathName) const;
  22. tolua_outside const Vector<String>& FileSystemScanDir @ ScanDir(const String pathName, const String filter, unsigned flags, bool recursive) const;
  23. String GetProgramDir() const;
  24. String GetUserDocumentsDir() const;
  25. };
  26. String GetPath(const String fullPath);
  27. String GetFileName(const String fullPath);
  28. String GetExtension(const String fullPath, bool lowercaseExtension = true);
  29. String GetFileNameAndExtension(const String fullPath, bool lowercaseExtension = false);
  30. String ReplaceExtension(const String fullPath, const String newExtension);
  31. String AddTrailingSlash(const String pathName);
  32. String RemoveTrailingSlash(const String pathName);
  33. String GetParentPath(const String pathName);
  34. String GetInternalPath(const String pathName);
  35. String GetNativePath(const String pathName);
  36. bool IsAbsolutePath(const String pathName);
  37. FileSystem * GetFileSystem();
  38. tolua_readonly tolua_property__get_set FileSystem* fileSystem;
  39. ${
  40. #define TOLUA_DISABLE_tolua_IOLuaAPI_GetFileSystem00
  41. static int tolua_IOLuaAPI_GetFileSystem00(lua_State* tolua_S)
  42. {
  43. return ToluaGetSubsystem<FileSystem>(tolua_S);
  44. }
  45. #define TOLUA_DISABLE_tolua_get_fileSystem_ptr
  46. #define tolua_get_fileSystem_ptr tolua_IOLuaAPI_GetFileSystem00
  47. static const Vector<String>& FileSystemScanDir(const FileSystem* fileSystem, const String pathName, const String filter, unsigned flags, bool recursive)
  48. {
  49. static Vector<String> result;
  50. fileSystem->ScanDir(result, pathName, filter, flags, recursive);
  51. return result;
  52. }
  53. $}