Fix PlayStation build regression
This commit is contained in:
@@ -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 <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <cerrno>
|
||||
#if HAS_DIRS
|
||||
#include <dirent.h>
|
||||
#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<String>& results, const String& pat
|
||||
|
||||
bool UnixFileSystem::GetChildDirectories(Array<String>& results, const String& path)
|
||||
{
|
||||
#if HAS_DIRS
|
||||
size_t pathLength;
|
||||
DIR* dir;
|
||||
struct stat statPath, statEntry;
|
||||
@@ -206,6 +219,9 @@ bool UnixFileSystem::GetChildDirectories(Array<String>& 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<String>& 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<String>& results, const char
|
||||
closedir(dir);
|
||||
|
||||
return false;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool UnixFileSystem::getFilesFromDirectoryAll(Array<String>& 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<String>& results, const char
|
||||
closedir(dir);
|
||||
|
||||
return false;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
DateTime UnixFileSystem::GetFileLastEditTime(const StringView& path)
|
||||
|
||||
Reference in New Issue
Block a user