Directory.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #pragma once
  2. #include <stdint.h>
  3. #include <string>
  4. #include <set>
  5. #include "il2cpp-string-types.h"
  6. #include "os/ErrorCodes.h"
  7. #include "utils/StringView.h"
  8. namespace il2cpp
  9. {
  10. namespace os
  11. {
  12. class Directory
  13. {
  14. public:
  15. static std::string GetCurrent(int* error);
  16. static bool SetCurrent(const std::string& path, int* error);
  17. static bool Create(const std::string& path, int *error);
  18. static bool Remove(const std::string& path, int *error);
  19. static std::set<std::string> GetFileSystemEntries(const std::string& path, const std::string& pathWithPattern, int32_t attrs, int32_t mask, int* error);
  20. struct FindHandle
  21. {
  22. void* osHandle;
  23. Il2CppNativeString directoryPath;
  24. Il2CppNativeString pattern;
  25. FindHandle(const utils::StringView<Il2CppNativeChar>& searchPathWithPattern);
  26. ~FindHandle();
  27. inline void SetOSHandle(void* osHandle) { this->osHandle = osHandle; }
  28. int32_t CloseOSHandle();
  29. };
  30. static os::ErrorCode FindFirstFile(FindHandle* findHandle, const utils::StringView<Il2CppNativeChar>& searchPathWithPattern, Il2CppNativeString* resultFileName, int32_t* resultAttributes);
  31. static os::ErrorCode FindNextFile(FindHandle* findHandle, Il2CppNativeString* resultFileName, int32_t* resultAttributes);
  32. };
  33. }
  34. }