X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6619c4af1b03055fc130d72077186867fbdd7340..06a32e049c1bad9249079ad2e91659303424a774:/src/unix/dir.cpp diff --git a/src/unix/dir.cpp b/src/unix/dir.cpp index f274a208d1..2924741545 100644 --- a/src/unix/dir.cpp +++ b/src/unix/dir.cpp @@ -31,6 +31,7 @@ #include "wx/dir.h" #include "wx/filefn.h" // for wxMatchWild +#include "wx/filename.h" #include #include @@ -149,13 +150,20 @@ bool wxDirData::Read(wxString *filename) break; } - // check the type now - if ( !(m_flags & wxDIR_FILES) && !wxDir::Exists(path + de_d_name) ) + // check the type now: notice that we may want to check the type of + // the path itself and not whatever it points to in case of a symlink + wxFileName fn = wxFileName::DirName(path + de_d_name); + if ( m_flags & wxDIR_NO_FOLLOW ) + { + fn.DontFollowLink(); + } + + if ( !(m_flags & wxDIR_FILES) && !fn.DirExists() ) { // it's a file, but we don't want them continue; } - else if ( !(m_flags & wxDIR_DIRS) && wxDir::Exists(path + de_d_name) ) + else if ( !(m_flags & wxDIR_DIRS) && fn.DirExists() ) { // it's a dir, and we don't want it continue;