FileSystem.pkg 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. };
  31. String GetPath(const String fullPath);
  32. String GetFileName(const String fullPath);
  33. String GetExtension(const String fullPath, bool lowercaseExtension = true);
  34. String GetFileNameAndExtension(const String fullPath, bool lowercaseExtension = false);
  35. String ReplaceExtension(const String fullPath, const String newExtension);
  36. String AddTrailingSlash(const String pathName);
  37. String RemoveTrailingSlash(const String pathName);
  38. String GetParentPath(const String pathName);
  39. String GetInternalPath(const String pathName);
  40. String GetNativePath(const String pathName);
  41. bool IsAbsolutePath(const String pathName);
  42. String GetFileSizeString(unsigned long long memorySize);
  43. FileSystem * GetFileSystem();
  44. tolua_readonly tolua_property__get_set FileSystem* fileSystem;
  45. ${
  46. #define TOLUA_DISABLE_tolua_IOLuaAPI_GetFileSystem00
  47. static int tolua_IOLuaAPI_GetFileSystem00(lua_State* tolua_S)
  48. {
  49. return ToluaGetSubsystem<FileSystem>(tolua_S);
  50. }
  51. #define TOLUA_DISABLE_tolua_get_fileSystem_ptr
  52. #define tolua_get_fileSystem_ptr tolua_IOLuaAPI_GetFileSystem00
  53. static const Vector<String>& FileSystemScanDir(const FileSystem* fileSystem, const String pathName, const String filter, unsigned flags, bool recursive)
  54. {
  55. static Vector<String> result;
  56. fileSystem->ScanDir(result, pathName, filter, flags, recursive);
  57. return result;
  58. }
  59. $}