[Scummvm-cvs-logs] CVS: scummvm/backends/fs/posix posix-fs.cpp,1.3,1.4
Max Horn
fingolfin at users.sourceforge.net
Fri Nov 15 09:06:05 CET 2002
Update of /cvsroot/scummvm/scummvm/backends/fs/posix
In directory usw-pr-cvs1:/tmp/cvs-serv6500
Modified Files:
posix-fs.cpp
Log Message:
use stat to detect directories -> should be POSIX compliant this time, and also work on Solaris
Index: posix-fs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/fs/posix/posix-fs.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- posix-fs.cpp 14 Nov 2002 14:42:04 -0000 1.3
+++ posix-fs.cpp 15 Nov 2002 17:05:50 -0000 1.4
@@ -25,6 +25,7 @@
#ifdef MACOSX
#include <sys/types.h>
#endif
+#include <sys/stat.h>
#include <dirent.h>
/*
@@ -86,6 +87,7 @@
FSList *POSIXFilesystemNode::listDir() const {
assert(_isDirectory);
DIR *dirp = opendir(_path.c_str());
+ struct stat st;
assert(dirp != 0);
struct dirent *dp;
@@ -99,13 +101,16 @@
POSIXFilesystemNode entry;
entry._displayName = dp->d_name;
- entry._isDirectory = (dp->d_type == DT_DIR); // TODO - add support for symlinks to dirs?
+ entry._path = _path;
+ entry._path += dp->d_name;
+
+ if (stat(entry._path.c_str(), &st))
+ continue;
+ entry._isDirectory = S_ISDIR(st.st_mode);
// FIXME - skip any non-directories for now
if (!entry._isDirectory) continue;
- entry._path = _path;
- entry._path += dp->d_name;
if (entry._isDirectory)
entry._path += "/";
myList->push_back(entry);
More information about the Scummvm-git-logs
mailing list