Add wxDIR_NO_FOLLOW flag for wxDir iteration.

This flag allows to avoid following the symbolic links during the directory
traversal. In particular, this means that links to the directories
(potentially outside the directory being traversed) are not considered as
directories at all when it is used, potentially avoiding surprises.

Closes #14542.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72740 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-10-23 23:57:32 +00:00
parent 6bf11d6720
commit c55f46d0a1
4 changed files with 36 additions and 9 deletions

View File

@@ -150,10 +150,13 @@ bool wxDirData::Read(wxString *filename)
break;
}
// check the type now: notice that we want to check the type of this
// path itself and not whatever it points to in case of a symlink
// 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);
fn.DontFollowLink();
if ( m_flags & wxDIR_NO_FOLLOW )
{
fn.DontFollowLink();
}
if ( !(m_flags & wxDIR_FILES) && !fn.DirExists() )
{