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