FileSystem.pkg 2.7 KB

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