mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-12-25 07:15:12 +02:00
Don't assume that all non-directories are regular files
Other types are not very likely, but if we do encounter them it is best to just skip them.
This commit is contained in:
parent
3eb3a8ed7a
commit
c7a5b874f1
@ -94,10 +94,11 @@ bool FileLister::browse(const string& path, bool clean)
|
||||
}
|
||||
}
|
||||
|
||||
bool isDir;
|
||||
bool isDir, isFile;
|
||||
#ifdef _DIRENT_HAVE_D_TYPE
|
||||
if (dptr->d_type != DT_UNKNOWN && dptr->d_type != DT_LNK) {
|
||||
isDir = dptr->d_type == DT_DIR;
|
||||
isFile = dptr->d_type == DT_REG;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
@ -109,6 +110,7 @@ bool FileLister::browse(const string& path, bool clean)
|
||||
continue;
|
||||
}
|
||||
isDir = S_ISDIR(st.st_mode);
|
||||
isFile = S_ISREG(st.st_mode);
|
||||
}
|
||||
|
||||
if (isDir) {
|
||||
@ -116,7 +118,7 @@ bool FileLister::browse(const string& path, bool clean)
|
||||
continue;
|
||||
|
||||
directorySet.insert(string(dptr->d_name));
|
||||
} else {
|
||||
} else if (isFile) {
|
||||
if (!showFiles)
|
||||
continue;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user