FileSystem.pkg 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 SetCurrentDir(const char* pathName);
  9. bool CreateDir(const String& pathName);
  10. bool CreateDir(const char* pathName);
  11. int SystemCommand(const String& commandLine);
  12. int SystemCommand(const char* commandLine);
  13. int SystemRun(const String& fileName, const Vector<String>& arguments);
  14. int SystemRun(const char* fileName, const Vector<String>& arguments);
  15. bool SystemOpen(const String& fileName, const String& mode = String::EMPTY);
  16. bool SystemOpen(const char* fileName, const char* mode = 0);
  17. bool Copy(const String& srcFileName, const String& destFileName);
  18. bool Copy(const char* srcFileName, const char* destFileName);
  19. bool Rename(const String& srcFileName, const String& destFileName);
  20. bool Rename(const char* srcFileName, const char* destFileName);
  21. bool Delete(const String& fileName);
  22. bool Delete(const char* fileName);
  23. void RegisterPath(const String& pathName);
  24. void RegisterPath(const char* pathName);
  25. String GetCurrentDir() const;
  26. bool HasRegisteredPaths() const;
  27. bool CheckAccess(const String& pathName) const;
  28. bool CheckAccess(const char* pathName) const;
  29. unsigned GetLastModifiedTime(const String& fileName) const;
  30. unsigned GetLastModifiedTime(const char* fileName) const;
  31. bool FileExists(const String& fileName) const;
  32. bool FileExists(const char* fileName) const;
  33. bool DirExists(const String& pathName) const;
  34. bool DirExists(const char* pathName) const;
  35. // void ScanDir(Vector<String>& result, const String& pathName, const String& filter, unsigned flags, bool recursive) const;
  36. tolua_outside Vector<String> FileSystemScanDir @ ScanDir(const String& pathName, const String& filter, unsigned flags, bool recursive) const;
  37. tolua_outside Vector<String> FileSystemScanDir @ ScanDir(const char* pathName, const char* filter, unsigned flags, bool recursive) const;
  38. String GetProgramDir() const;
  39. String GetUserDocumentsDir() const;
  40. };
  41. // void SplitPath(const String& fullPath, String& pathName, String& fileName, String& extension);
  42. String GetPath(const String& fullPath);
  43. String GetFileName(const String& fullPath);
  44. String GetExtension(const String& fullPath);
  45. String GetFileNameAndExtension(const String& fullPath);
  46. String ReplaceExtension(const String& fullPath, const String& newExtension);
  47. String AddTrailingSlash(const String& pathName);
  48. String RemoveTrailingSlash(const String& pathName);
  49. String GetParentPath(const String& pathName);
  50. String GetInternalPath(const String& pathName);
  51. String GetNativePath(const String& pathName);
  52. ${
  53. static Vector<String> FileSystemScanDir(const FileSystem* fileSystem, const String& pathName, const String& filter, unsigned flags, bool recursive)
  54. {
  55. Vector<String> result;
  56. fileSystem->ScanDir(result, pathName, filter, flags, recursive);
  57. return result;
  58. }
  59. $}