FileSystem.pkg 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. 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. FileSystem * GetFileSystem();
  43. tolua_readonly tolua_property__get_set FileSystem* fileSystem;
  44. ${
  45. #define TOLUA_DISABLE_tolua_IOLuaAPI_GetFileSystem00
  46. static int tolua_IOLuaAPI_GetFileSystem00(lua_State* tolua_S)
  47. {
  48. return ToluaGetSubsystem<FileSystem>(tolua_S);
  49. }
  50. #define TOLUA_DISABLE_tolua_get_fileSystem_ptr
  51. #define tolua_get_fileSystem_ptr tolua_IOLuaAPI_GetFileSystem00
  52. static const Vector<String>& FileSystemScanDir(const FileSystem* fileSystem, const String pathName, const String filter, unsigned flags, bool recursive)
  53. {
  54. static Vector<String> result;
  55. fileSystem->ScanDir(result, pathName, filter, flags, recursive);
  56. return result;
  57. }
  58. $}