1998-05-20 10:25:30 -04:00
|
|
|
\section{\class{wxPathList}}\label{wxpathlist}
|
|
|
|
|
|
|
|
The path list is a convenient way of storing a number of directories, and
|
|
|
|
when presented with a filename without a directory, searching for an existing file
|
2006-10-27 13:59:32 -04:00
|
|
|
in those directories.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2006-10-27 13:59:32 -04:00
|
|
|
Be sure to look also at \helpref{wxStandardPaths}{wxstandardpaths} if you only
|
|
|
|
want to search files in some standard paths.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\wxheading{Derived from}
|
|
|
|
|
2006-07-24 20:16:55 -04:00
|
|
|
\helpref{wxArrayString}{wxarraystring}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
1999-02-15 15:41:29 -05:00
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/filefn.h>
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\wxheading{See also}
|
|
|
|
|
2006-09-17 07:58:12 -04:00
|
|
|
\helpref{wxArrayString}{wxarraystring}, \helpref{wxStandardPaths}{wxstandardpaths}, \helpref{wxFileName}{wxfilename}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
2004-06-29 03:53:03 -04:00
|
|
|
|
2004-09-28 07:54:59 -04:00
|
|
|
\membersection{wxPathList::wxPathList}\label{wxpathlistctor}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\func{}{wxPathList}{\void}
|
|
|
|
|
2006-07-24 20:16:55 -04:00
|
|
|
Empty constructor.
|
|
|
|
|
|
|
|
\func{}{wxPathList}{\param{const wxArrayString\& }{arr}}
|
|
|
|
|
|
|
|
Constructs the object calling the \helpref{Add}{wxpathlistadd} function.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2004-06-29 03:53:03 -04:00
|
|
|
|
2004-09-28 07:54:59 -04:00
|
|
|
\membersection{wxPathList::AddEnvList}\label{wxpathlistaddenvlist}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\func{void}{AddEnvList}{\param{const wxString\& }{env\_variable}}
|
|
|
|
|
|
|
|
Finds the value of the given environment variable, and adds all paths
|
2006-10-27 13:59:32 -04:00
|
|
|
to the path list. Useful for finding files in the {\tt PATH} variable, for
|
1998-05-20 10:25:30 -04:00
|
|
|
example.
|
|
|
|
|
2004-06-29 03:53:03 -04:00
|
|
|
|
2004-09-28 07:54:59 -04:00
|
|
|
\membersection{wxPathList::Add}\label{wxpathlistadd}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2006-10-27 13:59:32 -04:00
|
|
|
\func{bool}{Add}{\param{const wxString\& }{path}}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2006-07-24 20:16:55 -04:00
|
|
|
\func{void}{Add}{\param{const wxArrayString\& }{arr}}
|
|
|
|
|
2006-09-17 07:58:12 -04:00
|
|
|
The first form adds the given directory to the path list, if the path is not already in the list.
|
2006-10-27 13:59:32 -04:00
|
|
|
If the path cannot be normalized for some reason, it returns \false.
|
|
|
|
|
2006-07-24 20:16:55 -04:00
|
|
|
The second form just calls the first form on all elements of the given array.
|
2004-06-29 03:53:03 -04:00
|
|
|
|
2006-09-17 07:58:12 -04:00
|
|
|
The {\it path} is always considered a directory but no existence checks will be done on it
|
|
|
|
(because if it doesn't exist, it could be created later and thus result a valid path when
|
|
|
|
\helpref{FindValidPath}{wxpathlistfindvalidpath} is called).
|
|
|
|
|
|
|
|
{\bf Note:} if the given path is relative, it won't be made absolute before adding it
|
|
|
|
(this is why \helpref{FindValidPath}{wxpathlistfindvalidpath} may return relative paths).
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2004-09-28 07:54:59 -04:00
|
|
|
\membersection{wxPathList::EnsureFileAccessible}\label{wxpathlistensurefileaccessible}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2006-10-27 13:59:32 -04:00
|
|
|
\func{bool}{EnsureFileAccessible}{\param{const wxString\& }{filename}}
|
|
|
|
|
|
|
|
Given a full filename (with path), ensures that the file exists and
|
|
|
|
then calls \helpref{Add}{wxpathlistadd} with the path of the file.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2006-10-27 13:59:32 -04:00
|
|
|
Returns \false if the file does not exist (and in this case its path won't be added).
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2004-06-29 03:53:03 -04:00
|
|
|
|
2004-09-28 07:54:59 -04:00
|
|
|
\membersection{wxPathList::FindAbsoluteValidPath}\label{wxpathlistfindabsolutepath}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2006-07-24 20:16:55 -04:00
|
|
|
\constfunc{wxString}{FindAbsoluteValidPath}{\param{const wxString\& }{file}}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2006-10-27 13:59:32 -04:00
|
|
|
Like \helpref{FindValidPath}{wxpathlistfindvalidpath} but this function always
|
|
|
|
returns an absolute path (eventually prepending the current working directory
|
|
|
|
to the value returned \helpref{FindValidPath}{wxpathlistfindvalidpath}) or an
|
|
|
|
empty string.
|
2004-06-29 03:53:03 -04:00
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2004-09-28 07:54:59 -04:00
|
|
|
\membersection{wxPathList::FindValidPath}\label{wxpathlistfindvalidpath}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2006-07-24 20:16:55 -04:00
|
|
|
\constfunc{wxString}{FindValidPath}{\param{const wxString\& }{file}}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2006-10-27 13:59:32 -04:00
|
|
|
Searches the given file in all paths stored in this class.
|
|
|
|
The first path which concatenated to the given string points to an existing
|
|
|
|
file (see \helpref{wxFileExists}{wxfileexists}) is returned.
|
2006-09-17 07:58:12 -04:00
|
|
|
|
2006-10-27 13:59:32 -04:00
|
|
|
If the file wasn't found in any of the stored paths, an empty string is returned.
|
2004-06-29 03:53:03 -04:00
|
|
|
|
2006-09-17 07:58:12 -04:00
|
|
|
The given string must be a file name, eventually with a path prefix (if the path
|
|
|
|
prefix is absolute, only its name will be searched); i.e. it must not end with
|
|
|
|
a directory separator (see \helpref{wxFileName::GetPathSeparator}{wxfilenamegetpathseparator})
|
|
|
|
otherwise an assertion will fail.
|
2006-10-10 13:46:49 -04:00
|
|
|
|
2006-10-27 13:59:32 -04:00
|
|
|
The returned path may be relative to the current working directory.
|
|
|
|
Note in fact that wxPathList can be used to store both relative and absolute paths so that
|
|
|
|
if you \helpref{Add()}{wxpathlistadd}ed relative paths, then the current working directory
|
|
|
|
(see \helpref{wxGetCwd}{wxgetcwd} and \helpref{wxSetWorkingDirectory}{wxsetworkingdirectory})
|
|
|
|
may affect the value returned by this function!
|
|
|
|
|