aboutsummaryrefslogtreecommitdiff
path: root/backends/fs/posix/posix-fs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backends/fs/posix/posix-fs.cpp')
-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 {