aboutsummaryrefslogtreecommitdiff
path: root/backends/fs/posix
diff options
context:
space:
mode:
authorDavid Corrales2007-06-04 03:46:56 +0000
committerDavid Corrales2007-06-04 03:46:56 +0000
commit3e7c5b027e2131cde30d994ccdb27c77f0118ffe (patch)
treeb0858f0a62292098230521df75fbae6fcbcc3e9f /backends/fs/posix
parent0cab5b7791e56b32455748bf20c21f0d6b42f654 (diff)
downloadscummvm-rg350-3e7c5b027e2131cde30d994ccdb27c77f0118ffe.tar.gz
scummvm-rg350-3e7c5b027e2131cde30d994ccdb27c77f0118ffe.tar.bz2
scummvm-rg350-3e7c5b027e2131cde30d994ccdb27c77f0118ffe.zip
Added a missing include in non-POSIX factories.
For the POSIX and Windows architectures, added exists(), isReadable() and isWritable() svn-id: r27073
Diffstat (limited to 'backends/fs/posix')
-rw-r--r--backends/fs/posix/posix-fs.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp
index 966bfe34e6..712a8ce68d 100644
--- a/backends/fs/posix/posix-fs.cpp
+++ b/backends/fs/posix/posix-fs.cpp
@@ -62,10 +62,13 @@ public:
*/
POSIXFilesystemNode(const String &path, bool verify);
+ virtual bool exists() const { return access(_path.c_str(), F_OK) == 0; }
virtual String getDisplayName() const { return _displayName; }
virtual String getName() const { return _displayName; }
virtual String getPath() const { return _path; }
virtual bool isDirectory() const { return _isDirectory; }
+ virtual bool isReadable() const { return access(_path.c_str(), R_OK) == 0; }
+ virtual bool isWritable() const { return access(_path.c_str(), W_OK) == 0; }
virtual bool isValid() const { return _isValid; }
virtual AbstractFilesystemNode *getChild(const String &n) const;
@@ -102,8 +105,9 @@ static const char *lastPathComponent(const Common::String &str) {
void POSIXFilesystemNode::setFlags() {
struct stat st;
+
_isValid = (0 == stat(_path.c_str(), &st));
- _isDirectory = _isValid ? S_ISDIR(st.st_mode) : false;
+ _isDirectory = _isValid ? S_ISDIR(st.st_mode) : false;
}
POSIXFilesystemNode::POSIXFilesystemNode() {
@@ -140,8 +144,6 @@ POSIXFilesystemNode::POSIXFilesystemNode(const String &p, bool verify) {
_path = p;
_displayName = lastPathComponent(_path);
- _isValid = true;
- _isDirectory = true;
if (verify) {
setFlags();