]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/pathlist.tex
Reverted renderer changes and just use window variant within renderer functions
[wxWidgets.git] / docs / latex / wx / pathlist.tex
CommitLineData
a660d684
KB
1\section{\class{wxPathList}}\label{wxpathlist}
2
3The path list is a convenient way of storing a number of directories, and
4when presented with a filename without a directory, searching for an existing file
34e2d943 5in those directories.
a660d684 6
34e2d943
RR
7Be sure to look also at \helpref{wxStandardPaths}{wxstandardpaths} if you only
8want to search files in some standard paths.
a660d684
KB
9
10\wxheading{Derived from}
11
8daf3c36 12\helpref{wxArrayString}{wxarraystring}
a660d684 13
954b8ae6
JS
14\wxheading{Include files}
15
16<wx/filefn.h>
17
a660d684
KB
18\wxheading{See also}
19
31a8bf3f 20\helpref{wxArrayString}{wxarraystring}, \helpref{wxStandardPaths}{wxstandardpaths}, \helpref{wxFileName}{wxfilename}
a660d684
KB
21
22\latexignore{\rtfignore{\wxheading{Members}}}
23
4d01e350 24
dcbd177f 25\membersection{wxPathList::wxPathList}\label{wxpathlistctor}
a660d684
KB
26
27\func{}{wxPathList}{\void}
28
8daf3c36
VZ
29Empty constructor.
30
31\func{}{wxPathList}{\param{const wxArrayString\& }{arr}}
32
33Constructs the object calling the \helpref{Add}{wxpathlistadd} function.
a660d684 34
4d01e350 35
dcbd177f 36\membersection{wxPathList::AddEnvList}\label{wxpathlistaddenvlist}
a660d684
KB
37
38\func{void}{AddEnvList}{\param{const wxString\& }{env\_variable}}
39
40Finds the value of the given environment variable, and adds all paths
34e2d943 41to the path list. Useful for finding files in the {\tt PATH} variable, for
a660d684
KB
42example.
43
4d01e350 44
dcbd177f 45\membersection{wxPathList::Add}\label{wxpathlistadd}
a660d684 46
34e2d943 47\func{bool}{Add}{\param{const wxString\& }{path}}
a660d684 48
8daf3c36
VZ
49\func{void}{Add}{\param{const wxArrayString\& }{arr}}
50
31a8bf3f 51The first form adds the given directory to the path list, if the path is not already in the list.
34e2d943
RR
52If the path cannot be normalized for some reason, it returns \false.
53
8daf3c36 54The second form just calls the first form on all elements of the given array.
4d01e350 55
31a8bf3f
RR
56The {\it path} is always considered a directory but no existence checks will be done on it
57(because if it doesn't exist, it could be created later and thus result a valid path when
58\helpref{FindValidPath}{wxpathlistfindvalidpath} is called).
59
60{\bf Note:} if the given path is relative, it won't be made absolute before adding it
61(this is why \helpref{FindValidPath}{wxpathlistfindvalidpath} may return relative paths).
62
a660d684 63
dcbd177f 64\membersection{wxPathList::EnsureFileAccessible}\label{wxpathlistensurefileaccessible}
a660d684 65
34e2d943
RR
66\func{bool}{EnsureFileAccessible}{\param{const wxString\& }{filename}}
67
4ba9f845
VZ
68Given a full filename (with path), calls \helpref{Add}{wxpathlistadd} with the path
69of the file.
a660d684 70
4d01e350 71
dcbd177f 72\membersection{wxPathList::FindAbsoluteValidPath}\label{wxpathlistfindabsolutepath}
a660d684 73
8daf3c36 74\constfunc{wxString}{FindAbsoluteValidPath}{\param{const wxString\& }{file}}
a660d684 75
34e2d943
RR
76Like \helpref{FindValidPath}{wxpathlistfindvalidpath} but this function always
77returns an absolute path (eventually prepending the current working directory
78to the value returned \helpref{FindValidPath}{wxpathlistfindvalidpath}) or an
79empty string.
4d01e350 80
a660d684 81
dcbd177f 82\membersection{wxPathList::FindValidPath}\label{wxpathlistfindvalidpath}
a660d684 83
8daf3c36 84\constfunc{wxString}{FindValidPath}{\param{const wxString\& }{file}}
a660d684 85
34e2d943
RR
86Searches the given file in all paths stored in this class.
87The first path which concatenated to the given string points to an existing
88file (see \helpref{wxFileExists}{wxfileexists}) is returned.
31a8bf3f 89
34e2d943 90If the file wasn't found in any of the stored paths, an empty string is returned.
4d01e350 91
31a8bf3f
RR
92The given string must be a file name, eventually with a path prefix (if the path
93prefix is absolute, only its name will be searched); i.e. it must not end with
94a directory separator (see \helpref{wxFileName::GetPathSeparator}{wxfilenamegetpathseparator})
95otherwise an assertion will fail.
b67a86d5 96
34e2d943
RR
97The returned path may be relative to the current working directory.
98Note in fact that wxPathList can be used to store both relative and absolute paths so that
99if you \helpref{Add()}{wxpathlistadd}ed relative paths, then the current working directory
100(see \helpref{wxGetCwd}{wxgetcwd} and \helpref{wxSetWorkingDirectory}{wxsetworkingdirectory})
101may affect the value returned by this function!
102