aboutsummaryrefslogtreecommitdiff
path: root/backends/fs/posix/posix-fs.cpp
diff options
context:
space:
mode:
authorCameron Cawley2019-04-15 16:09:06 +0100
committerFilippos Karapetis2019-04-16 00:55:43 +0300
commitab0fab9bf97530cbd6088aa0ffbb67e810a04e7f (patch)
tree6c60d6a9a28d2d09df7e3f631535a296d8459f97 /backends/fs/posix/posix-fs.cpp
parent4cb79db612d2e4735a38538bb95aa07131fcda23 (diff)
downloadscummvm-rg350-ab0fab9bf97530cbd6088aa0ffbb67e810a04e7f.tar.gz
scummvm-rg350-ab0fab9bf97530cbd6088aa0ffbb67e810a04e7f.tar.bz2
scummvm-rg350-ab0fab9bf97530cbd6088aa0ffbb67e810a04e7f.zip
POSIX: Move implementation of exists, isReadable and isWritable into posix-fs.cpp
Diffstat (limited to 'backends/fs/posix/posix-fs.cpp')
-rw-r--r--backends/fs/posix/posix-fs.cpp16
1 files changed, 16 insertions, 0 deletions
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 <sys/param.h>
#include <sys/stat.h>
+#ifdef MACOSX
+#include <sys/types.h>
+#endif
#ifdef PSP2
#include "backends/fs/psp2/psp2-dirent.h"
#define mkdir sceIoMkdir
@@ -47,6 +50,7 @@
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
+#include <unistd.h>
#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;