diff --git a/Source/Engine/Platform/Unix/UnixFileSystem.cpp b/Source/Engine/Platform/Unix/UnixFileSystem.cpp index 1fb47f0f5..528df5b88 100644 --- a/Source/Engine/Platform/Unix/UnixFileSystem.cpp +++ b/Source/Engine/Platform/Unix/UnixFileSystem.cpp @@ -2,6 +2,8 @@ #if PLATFORM_UNIX +#define HAS_DIRS !PLATFORM_PS4 && !PLATFORM_PS5 + #include "UnixFileSystem.h" #include "Engine/Platform/File.h" #include "Engine/Core/Types/TimeSpan.h" @@ -13,7 +15,9 @@ #include #include #include +#if HAS_DIRS #include +#endif #if PLATFORM_MAC || PLATFORM_IOS typedef StringAsANSI<> UnixString; @@ -48,6 +52,8 @@ bool UnixFileSystem::CreateDirectory(const StringView& path) return mkdir(pathAnsi.Get(), 0755) != 0 && errno != EEXIST; } +#if HAS_DIRS + bool DeleteUnixPathTree(const char* path) { size_t pathLength; @@ -114,8 +120,11 @@ bool DeleteUnixPathTree(const char* path) return false; } +#endif + bool UnixFileSystem::DeleteDirectory(const String& path, bool deleteContents) { +#if HAS_DIRS const UnixString pathANSI(*path, path.Length()); if (deleteContents) { @@ -125,6 +134,9 @@ bool UnixFileSystem::DeleteDirectory(const String& path, bool deleteContents) { return rmdir(pathANSI.Get()) != 0; } +#else + return true; +#endif } bool UnixFileSystem::DirectoryExists(const StringView& path) @@ -151,6 +163,7 @@ bool UnixFileSystem::DirectoryGetFiles(Array& results, const String& pat bool UnixFileSystem::GetChildDirectories(Array& results, const String& path) { +#if HAS_DIRS size_t pathLength; DIR* dir; struct stat statPath, statEntry; @@ -206,6 +219,9 @@ bool UnixFileSystem::GetChildDirectories(Array& results, const String& p closedir(dir); return false; +#else + return true; +#endif } bool UnixFileSystem::FileExists(const StringView& path) @@ -243,12 +259,16 @@ uint64 UnixFileSystem::GetFileSize(const StringView& path) bool UnixFileSystem::IsReadOnly(const StringView& path) { +#if HAS_DIRS const UnixString pathANSI(*path, path.Length()); if (access(pathANSI.Get(), W_OK) == -1) { return errno == EACCES; } return false; +#else + return true; +#endif } bool UnixFileSystem::SetReadOnly(const StringView& path, bool isReadOnly) @@ -299,6 +319,7 @@ bool UnixFileSystem::MoveFile(const StringView& dst, const StringView& src, bool bool UnixFileSystem::getFilesFromDirectoryTop(Array& results, const char* path, const char* searchPattern) { +#if HAS_DIRS size_t pathLength; struct stat statPath, statEntry; struct dirent* entry; @@ -389,10 +410,14 @@ bool UnixFileSystem::getFilesFromDirectoryTop(Array& results, const char closedir(dir); return false; +#else + return true; +#endif } bool UnixFileSystem::getFilesFromDirectoryAll(Array& results, const char* path, const char* searchPattern) { +#if HAS_DIRS // Find all files in this directory getFilesFromDirectoryTop(results, path, searchPattern); @@ -452,6 +477,9 @@ bool UnixFileSystem::getFilesFromDirectoryAll(Array& results, const char closedir(dir); return false; +#else + return true; +#endif } DateTime UnixFileSystem::GetFileLastEditTime(const StringView& path)