FileSystem.pkg 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. $#include "IO/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. void SetExecuteConsoleCommands(bool enable);
  10. int SystemCommand(const String commandLine, bool redirectStdOutToLog = false);
  11. int SystemRun(const String fileName, const Vector<String>& arguments);
  12. unsigned SystemCommandAsync(const String commandLine);
  13. unsigned SystemRunAsync(const String fileName, const Vector<String>& arguments);
  14. bool SystemOpen(const String fileName, const String mode = String::EMPTY);
  15. bool Copy(const String srcFileName, const String destFileName);
  16. bool Rename(const String srcFileName, const String destFileName);
  17. bool Delete(const String fileName);
  18. bool SetLastModifiedTime(const String fileName, unsigned newTime);
  19. String GetCurrentDir() const;
  20. bool GetExecuteConsoleCommands() const;
  21. bool HasRegisteredPaths() const;
  22. bool CheckAccess(const String pathName) const;
  23. unsigned GetLastModifiedTime(const String fileName) const;
  24. bool FileExists(const String fileName) const;
  25. bool DirExists(const String pathName) const;
  26. tolua_outside const Vector<String>& FileSystemScanDir @ ScanDir(const String pathName, const String filter, unsigned flags, bool recursive) const;
  27. String GetProgramDir() const;
  28. String GetUserDocumentsDir() const;
  29. String GetAppPreferencesDir(const String org, const String app) const;
  30. String GetTemporaryDir() const;
  31. };
  32. String GetPath(const String fullPath);
  33. String GetFileName(const String fullPath);
  34. String GetExtension(const String fullPath, bool lowercaseExtension = true);
  35. String GetFileNameAndExtension(const String fullPath, bool lowercaseExtension = false);
  36. String ReplaceExtension(const String fullPath, const String newExtension);
  37. String AddTrailingSlash(const String pathName);
  38. String RemoveTrailingSlash(const String pathName);
  39. String GetParentPath(const String pathName);
  40. String GetInternalPath(const String pathName);
  41. String GetNativePath(const String pathName);
  42. bool IsAbsolutePath(const String pathName);
  43. String GetFileSizeString(unsigned long long memorySize);
  44. FileSystem * GetFileSystem();
  45. tolua_readonly tolua_property__get_set FileSystem* fileSystem;
  46. ${
  47. #define TOLUA_DISABLE_tolua_IOLuaAPI_GetFileSystem00
  48. static int tolua_IOLuaAPI_GetFileSystem00(lua_State* tolua_S)
  49. {
  50. return ToluaGetSubsystem<FileSystem>(tolua_S);
  51. }
  52. #define TOLUA_DISABLE_tolua_get_fileSystem_ptr
  53. #define tolua_get_fileSystem_ptr tolua_IOLuaAPI_GetFileSystem00
  54. static const Vector<String>& FileSystemScanDir(const FileSystem* fileSystem, const String pathName, const String filter, unsigned flags, bool recursive)
  55. {
  56. static Vector<String> result;
  57. fileSystem->ScanDir(result, pathName, filter, flags, recursive);
  58. return result;
  59. }
  60. $}