]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/pathlist.tex
Moved desktop margin options to a more sensible place
[wxWidgets.git] / docs / latex / wx / pathlist.tex
... / ...
CommitLineData
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
5in those directories.
6
7Be sure to look also at \helpref{wxStandardPaths}{wxstandardpaths} if you only
8want to search files in some standard paths.
9
10\wxheading{Derived from}
11
12\helpref{wxArrayString}{wxarraystring}\\
13\helpref{wxArray}{wxarray}
14
15\wxheading{Include files}
16
17<wx/filefn.h>
18
19\wxheading{Library}
20
21\helpref{wxBase}{librarieslist}
22
23\wxheading{See also}
24
25\helpref{wxArrayString}{wxarraystring}, \helpref{wxStandardPaths}{wxstandardpaths}, \helpref{wxFileName}{wxfilename}
26
27\latexignore{\rtfignore{\wxheading{Members}}}
28
29
30\membersection{wxPathList::wxPathList}\label{wxpathlistctor}
31
32\func{}{wxPathList}{\void}
33
34Empty constructor.
35
36\func{}{wxPathList}{\param{const wxArrayString\& }{arr}}
37
38Constructs the object calling the \helpref{Add}{wxpathlistadd} function.
39
40
41\membersection{wxPathList::AddEnvList}\label{wxpathlistaddenvlist}
42
43\func{void}{AddEnvList}{\param{const wxString\& }{env\_variable}}
44
45Finds the value of the given environment variable, and adds all paths
46to the path list. Useful for finding files in the {\tt PATH} variable, for
47example.
48
49
50\membersection{wxPathList::Add}\label{wxpathlistadd}
51
52\func{bool}{Add}{\param{const wxString\& }{path}}
53
54\func{void}{Add}{\param{const wxArrayString\& }{arr}}
55
56The first form adds the given directory to the path list, if the path is not already in the list.
57If the path cannot be normalized for some reason, it returns \false.
58
59The second form just calls the first form on all elements of the given array.
60
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
68
69\membersection{wxPathList::EnsureFileAccessible}\label{wxpathlistensurefileaccessible}
70
71\func{bool}{EnsureFileAccessible}{\param{const wxString\& }{filename}}
72
73Given a full filename (with path), calls \helpref{Add}{wxpathlistadd} with the path
74of the file.
75
76
77\membersection{wxPathList::FindAbsoluteValidPath}\label{wxpathlistfindabsolutepath}
78
79\constfunc{wxString}{FindAbsoluteValidPath}{\param{const wxString\& }{file}}
80
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.
85
86
87\membersection{wxPathList::FindValidPath}\label{wxpathlistfindvalidpath}
88
89\constfunc{wxString}{FindValidPath}{\param{const wxString\& }{file}}
90
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.
94
95If the file wasn't found in any of the stored paths, an empty string is returned.
96
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.
101
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