From ab0fab9bf97530cbd6088aa0ffbb67e810a04e7f Mon Sep 17 00:00:00 2001 From: Cameron Cawley Date: Mon, 15 Apr 2019 16:09:06 +0100 Subject: POSIX: Move implementation of exists, isReadable and isWritable into posix-fs.cpp --- backends/fs/posix/posix-fs.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'backends/fs/posix/posix-fs.cpp') diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp index b0c888966f..9d2416a9bc 100644 --- a/backends/fs/posix/posix-fs.cpp +++ b/backends/fs/posix/posix-fs.cpp @@ -38,6 +38,9 @@ #include #include +#ifdef MACOSX +#include +#endif #ifdef PSP2 #include "backends/fs/psp2/psp2-dirent.h" #define mkdir sceIoMkdir @@ -47,6 +50,7 @@ #include #include #include +#include #ifdef __OS2__ #define INCL_DOS @@ -54,6 +58,18 @@ #endif +bool POSIXFilesystemNode::exists() const { + return access(_path.c_str(), F_OK) == 0; +} + +bool POSIXFilesystemNode::isReadable() const { + return access(_path.c_str(), R_OK) == 0; +} + +bool POSIXFilesystemNode::isWritable() const { + return access(_path.c_str(), W_OK) == 0; +} + void POSIXFilesystemNode::setFlags() { struct stat st; -- cgit v1.2.3