aboutsummaryrefslogtreecommitdiff
path: root/backends/fs/posix
diff options
context:
space:
mode:
authorMax Horn2006-04-23 12:29:43 +0000
committerMax Horn2006-04-23 12:29:43 +0000
commit307f4e387b086095dc4241c64d95007ba534eb8b (patch)
tree6b9941b6441a9c1b05f3186801ab8354720418eb /backends/fs/posix
parenteb895185a6832e8849c89d964fccf2ecfc50a481 (diff)
downloadscummvm-rg350-307f4e387b086095dc4241c64d95007ba534eb8b.tar.gz
scummvm-rg350-307f4e387b086095dc4241c64d95007ba534eb8b.tar.bz2
scummvm-rg350-307f4e387b086095dc4241c64d95007ba534eb8b.zip
Fixed getNodeForPath on systems using POSIXFilesystemNode to again correctly check whether the given path exists, and whether it points to a directory
svn-id: r22097
Diffstat (limited to 'backends/fs/posix')
-rw-r--r--backends/fs/posix/posix-fs.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp
index e5c8c71ae3..081325beba 100644
--- a/backends/fs/posix/posix-fs.cpp
+++ b/backends/fs/posix/posix-fs.cpp
@@ -49,7 +49,7 @@ protected:
public:
POSIXFilesystemNode();
- POSIXFilesystemNode(const String &path);
+ POSIXFilesystemNode(const String &path, bool useStat = false);
virtual String displayName() const { return _displayName; }
virtual bool isValid() const { return _isValid; }
@@ -77,7 +77,7 @@ AbstractFilesystemNode *FilesystemNode::getRoot() {
}
AbstractFilesystemNode *FilesystemNode::getNodeForPath(const String &path) {
- return new POSIXFilesystemNode(path);
+ return new POSIXFilesystemNode(path, true);
}
POSIXFilesystemNode::POSIXFilesystemNode() {
@@ -103,13 +103,21 @@ POSIXFilesystemNode::POSIXFilesystemNode() {
_isDirectory = true;
}
-POSIXFilesystemNode::POSIXFilesystemNode(const String &p) {
+POSIXFilesystemNode::POSIXFilesystemNode(const String &p, bool useStat) {
assert(p.size() > 0);
_path = p;
_displayName = lastPathComponent(_path);
_isValid = true;
_isDirectory = true;
+
+#ifndef __DC__
+ if (useStat) {
+ struct stat st;
+ _isValid = (0 == stat(_path.c_str(), &st));
+ _isDirectory = S_ISDIR(st.st_mode);
+ }
+#endif
}
FSList POSIXFilesystemNode::listDir(ListMode mode) const {