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