Merge branch 'next' of git://gitorious.org/fg/simgear into next
This commit is contained in:
@@ -67,6 +67,7 @@
|
|||||||
# define vsnprintf _vsnprintf
|
# define vsnprintf _vsnprintf
|
||||||
# endif
|
# endif
|
||||||
# define copysign _copysign
|
# define copysign _copysign
|
||||||
|
# define strcasecmp stricmp
|
||||||
|
|
||||||
# pragma warning(disable: 4786) // identifier was truncated to '255' characters
|
# pragma warning(disable: 4786) // identifier was truncated to '255' characters
|
||||||
# pragma warning(disable: 4244) // conversion from double to float
|
# pragma warning(disable: 4244) // conversion from double to float
|
||||||
|
|||||||
+22
-2
@@ -29,6 +29,8 @@
|
|||||||
# include <dirent.h>
|
# include <dirent.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include <simgear/debug/logstream.hxx>
|
#include <simgear/debug/logstream.hxx>
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@@ -111,7 +113,25 @@ PathList Dir::children(int types, const std::string& nameFilter) const
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry->d_type == DT_DIR) {
|
int type = entry->d_type;
|
||||||
|
if (type == DT_LNK) {
|
||||||
|
// find symlink target type using stat()
|
||||||
|
struct stat s;
|
||||||
|
if (stat(file(entry->d_name).c_str(), &s)) {
|
||||||
|
continue; // stat() failed
|
||||||
|
}
|
||||||
|
|
||||||
|
if (S_ISDIR(s.st_mode)) {
|
||||||
|
type = DT_DIR;
|
||||||
|
} else if (S_ISREG(s.st_mode)) {
|
||||||
|
type = DT_REG;
|
||||||
|
} else {
|
||||||
|
// symlink to block/fifo/char file, ignore
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} // of symlink look-through
|
||||||
|
|
||||||
|
if (type == DT_DIR) {
|
||||||
if (!(types & TYPE_DIR)) {
|
if (!(types & TYPE_DIR)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -121,7 +141,7 @@ PathList Dir::children(int types, const std::string& nameFilter) const
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (entry->d_type == DT_REG) {
|
} else if (type == DT_REG) {
|
||||||
if (!(types & TYPE_FILE)) {
|
if (!(types & TYPE_FILE)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user