X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fc2171bd4c660b8554dae2a1cbf34ff09f3032a6..81c882b613b5d99ddb1e5ab69fcd7ebccc287025:/docs/latex/wx/dir.tex diff --git a/docs/latex/wx/dir.tex b/docs/latex/wx/dir.tex index d92f7e95f7..c9b6a29d53 100644 --- a/docs/latex/wx/dir.tex +++ b/docs/latex/wx/dir.tex @@ -6,14 +6,14 @@ %% Created: 04.04.00 %% RCS-ID: $Id$ %% Copyright: (c) Vadim Zeitlin -%% License: wxWidgets license +%% License: wxWindows license %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{\class{wxDir}}\label{wxdir} wxDir is a portable equivalent of Unix {open/read/close}dir functions which -allow enumerating of the files in a directory. wxDir allows enumerate files as -well as directories. +allow enumerating of the files in a directory. wxDir allows to enumerate files +as well as directories. wxDir also provides a flexible way to enumerate files recursively using \helpref{Traverse}{wxdirtraverse} or a simpler @@ -106,7 +106,7 @@ Test for existence of a directory with the given name \func{static size\_t}{GetAllFiles}{\param{const wxString\& }{dirname}, \param{wxArrayString *}{files}, \param{const wxString\& }{filespec = wxEmptyString}, \param{int }{flags = wxDIR\_DEFAULT}} The function appends the names of all the files under directory {\it dirname} -to the array {\it files} (note that its old contents is preserved). Only files +to the array {\it files} (note that its old content is preserved). Only files matching the {\it filespec} are taken, with empty spec matching all the files. The {\it flags} parameter should always include {\tt wxDIR\_FILES} or the array @@ -116,12 +116,28 @@ subdirectories (both flags are included in the value by default). See also: \helpref{Traverse}{wxdirtraverse} +\membersection{wxDir::FindFirst}\label{wxdirfindfirst} + +\func{static wxString}{FindFirst}{\param{const wxString\& }{dirname}, \param{const wxString\& }{filespec}, \param{int }{flags = wxDIR\_DEFAULT}} + +The function returns the path of the first file matching the given \arg{filespec} +or an empty string if there are no files matching it. + +The \arg{flags} parameter may or may not include {\tt wxDIR\_FILES}, the +function always behaves as if it were specified. By default, \arg{flags} +includes {\tt wxDIR\_DIRS} and so the function recurses into the subdirectories +but if this flag is not specified, the function restricts the search only to +the directory \arg{dirname} itself. + +See also: \helpref{Traverse}{wxdirtraverse} + + \membersection{wxDir::GetFirst}\label{wxdirgetfirst} \constfunc{bool}{GetFirst}{\param{wxString* }{filename}, \param{const wxString\& }{filespec = wxEmptyString}, \param{int }{flags = wxDIR\_DEFAULT}} Start enumerating all files matching {\it filespec} (or all files if it is -empty) and flags, return true on success. +empty) and {\it flags}, return \true on success. \membersection{wxDir::GetName}\label{wxdirgetname} @@ -136,8 +152,27 @@ trailing path separator (slash or backslash). \constfunc{bool}{GetNext}{\param{wxString* }{filename}} -Continue enumerating files satisfying the criteria specified by the last call -to \helpref{GetFirst}{wxdirgetfirst}. +Continue enumerating files which satisfy the criteria specified by the last +call to \helpref{GetFirst}{wxdirgetfirst}. + + +\membersection{wxDir::GetTotalSize}\label{wxdirgettotalsize} + +\func{static wxULongLong}{GetTotalSize}{\param{const wxString\& }{dir}, \param{wxArrayString* }{filesSkipped = NULL}} + +Returns the size (in bytes) of all files recursively found in {\tt dir} or +{\tt wxInvalidSize} in case of error. + +In case it happens that while traversing folders a file's size can not be read, +that file is added to the {\tt filesSkipped} array, if not \NULL, and then +skipped. +This usually happens with some special folders which are locked by the operating system +or by another process. Remember that when {\tt filesSkipped->GetCount()} is not zero, +then the returned value is not 100\% accurate and, if the skipped files were big, it could be +far from real size of the directory. + +See also: \helpref{wxFileName::GetHumanReadableSize}{wxfilenamegethumanreadablesize}, +\helpref{wxGetDiskSpace}{wxgetdiskspace} \membersection{wxDir::HasFiles}\label{wxdirhasfiles} @@ -170,8 +205,8 @@ Returns true if the directory was successfully opened by a previous call to \func{bool}{Open}{\param{const wxString\& }{dir}} -Open the directory for enumerating, returns true on success or false if an -error occurred. +Open the directory for enumerating, returns {\tt true} on success +or {\tt false} if an error occurred. \membersection{wxDir::Traverse}\label{wxdirtraverse}