[Scummvm-cvs-logs] SF.net SVN: scummvm: [22097] scummvm/trunk/backends/fs/posix/posix-fs.cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sun Apr 23 05:30:14 CEST 2006


Revision: 22097
Author:   fingolfin
Date:     2006-04-23 05:29:43 -0700 (Sun, 23 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22097&view=rev

Log Message:
-----------
Fixed getNodeForPath on systems using POSIXFilesystemNode to again correctly check whether the given path exists, and whether it points to a directory

Modified Paths:
--------------
    scummvm/trunk/backends/fs/posix/posix-fs.cpp
Modified: scummvm/trunk/backends/fs/posix/posix-fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/posix/posix-fs.cpp	2006-04-23 12:12:29 UTC (rev 22096)
+++ scummvm/trunk/backends/fs/posix/posix-fs.cpp	2006-04-23 12:29:43 UTC (rev 22097)
@@ -49,7 +49,7 @@
 
 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::getNodeForPath(const String &path) {
-	return new POSIXFilesystemNode(path);
+	return new POSIXFilesystemNode(path, true);
 }
 
 POSIXFilesystemNode::POSIXFilesystemNode() {
@@ -103,13 +103,21 @@
 	_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 {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list