// Name: dir.h
// Purpose: interface of wxDir and wxDirTraverser
// Author: wxWidgets team
-// RCS-ID: $Id$
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/**
- These flags define what kind of filenames are included in the list of files
- enumerated by wxDir::GetFirst() and wxDir::GetNext().
+ These flags affect the behaviour of GetFirst/GetNext() and Traverse(),
+ determining what types are included in the list of items they produce.
*/
enum wxDirFlags
{
wxDIR_HIDDEN = 0x0004, ///< Includes hidden files.
wxDIR_DOTDOT = 0x0008, ///< Includes "." and "..".
- //! Combination of the @c wxDIR_FILES, @c wxDIR_DIRS, @c wxDIR_HIDDEN flags
- //! defined above.
+ /**
+ Don't follow symbolic links during the directory traversal.
+
+ This flag is ignored under systems not supporting symbolic links (i.e.
+ non-Unix ones).
+
+ Notice that this flag is @e not included in wxDIR_DEFAULT and so the
+ default behaviour of wxDir::Traverse() is to follow symbolic links,
+ even if they lead outside of the directory being traversed.
+
+ @since 2.9.5
+ */
+ wxDIR_NO_FOLLOW = 0x0010,
+
+ /**
+ Default directory traversal flags include both files and directories,
+ even hidden.
+
+ Notice that by default wxDIR_NO_FOLLOW is @e not included, meaning that
+ symbolic links are followed by default. If this is not desired, you
+ must pass that flag explicitly.
+ */
wxDIR_DEFAULT = wxDIR_FILES | wxDIR_DIRS | wxDIR_HIDDEN
};
wxDir(const wxString& dir);
/**
- Destructor cleans up the associated resources. It is not virtual and so
- this class is not meant to be used polymorphically.
+ Destructor cleans up the associated resources by calling Close().
+
+ It is not virtual and so this class is not meant to be used
+ polymorphically.
*/
~wxDir();
+ /**
+ Close the directory.
+
+ The object can't be used after closing it, but Open() may be called
+ again to reopen it later.
+
+ @since 2.9.5
+ */
+ void Close();
+
/**
Test for existence of a directory with the given name.
*/
Notice that in spite of this the last character of the returned string
can still be the path separator if this directory is the root one.
- Because of this, don't append ::wxFILE_SEP_PATH to the returned value
+ Because of this, don't append @c wxFILE_SEP_PATH to the returned value
if you do need a slash-terminated directory name but use
GetNameWithSep() instead to avoid having duplicate consecutive slashes.
*/
/**
Returns the name of the directory with the path separator appended.
- The last character of the returned string is always ::wxFILE_SEP_PATH
+ The last character of the returned string is always @c wxFILE_SEP_PATH
unless the string is empty, indicating that this directory is invalid.
@see GetName()