]>
Commit | Line | Data |
---|---|---|
a660d684 KB |
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. Storing the filename only in an application's files and | |
6 | using a locally-defined list of directories makes the application and its files more | |
7 | portable. | |
8 | ||
8daf3c36 VZ |
9 | Use the \helpref{wxFileName::SplitPath}{wxfilenamesplitpath} global function |
10 | to extract the filename from the path. | |
a660d684 KB |
11 | |
12 | \wxheading{Derived from} | |
13 | ||
8daf3c36 | 14 | \helpref{wxArrayString}{wxarraystring} |
a660d684 | 15 | |
954b8ae6 JS |
16 | \wxheading{Include files} |
17 | ||
18 | <wx/filefn.h> | |
19 | ||
a660d684 KB |
20 | \wxheading{See also} |
21 | ||
31a8bf3f | 22 | \helpref{wxArrayString}{wxarraystring}, \helpref{wxStandardPaths}{wxstandardpaths}, \helpref{wxFileName}{wxfilename} |
a660d684 KB |
23 | |
24 | \latexignore{\rtfignore{\wxheading{Members}}} | |
25 | ||
4d01e350 | 26 | |
dcbd177f | 27 | \membersection{wxPathList::wxPathList}\label{wxpathlistctor} |
a660d684 KB |
28 | |
29 | \func{}{wxPathList}{\void} | |
30 | ||
8daf3c36 VZ |
31 | Empty constructor. |
32 | ||
33 | \func{}{wxPathList}{\param{const wxArrayString\& }{arr}} | |
34 | ||
35 | Constructs the object calling the \helpref{Add}{wxpathlistadd} function. | |
a660d684 | 36 | |
4d01e350 | 37 | |
dcbd177f | 38 | \membersection{wxPathList::AddEnvList}\label{wxpathlistaddenvlist} |
a660d684 KB |
39 | |
40 | \func{void}{AddEnvList}{\param{const wxString\& }{env\_variable}} | |
41 | ||
42 | Finds the value of the given environment variable, and adds all paths | |
43 | to the path list. Useful for finding files in the PATH variable, for | |
44 | example. | |
45 | ||
4d01e350 | 46 | |
dcbd177f | 47 | \membersection{wxPathList::Add}\label{wxpathlistadd} |
a660d684 KB |
48 | |
49 | \func{void}{Add}{\param{const wxString\& }{path}} | |
50 | ||
8daf3c36 VZ |
51 | \func{void}{Add}{\param{const wxArrayString\& }{arr}} |
52 | ||
31a8bf3f | 53 | The first form adds the given directory to the path list, if the path is not already in the list. |
8daf3c36 | 54 | The second form just calls the first form on all elements of the given array. |
4d01e350 | 55 | |
31a8bf3f RR |
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 | ||
a660d684 | 63 | |
dcbd177f | 64 | \membersection{wxPathList::EnsureFileAccessible}\label{wxpathlistensurefileaccessible} |
a660d684 KB |
65 | |
66 | \func{void}{EnsureFileAccessible}{\param{const wxString\& }{filename}} | |
67 | ||
68 | Given a full filename (with path), ensures that files in the same path | |
69 | can be accessed using the pathlist. It does this by stripping the | |
70 | filename and adding the path to the list if not already there. | |
71 | ||
4d01e350 | 72 | |
dcbd177f | 73 | \membersection{wxPathList::FindAbsoluteValidPath}\label{wxpathlistfindabsolutepath} |
a660d684 | 74 | |
8daf3c36 | 75 | \constfunc{wxString}{FindAbsoluteValidPath}{\param{const wxString\& }{file}} |
a660d684 | 76 | |
31a8bf3f | 77 | Searches for a full (i.e. absolute) path for an existing file by appending {\it file} to |
4d01e350 VZ |
78 | successive members of the path list. If the file wasn't found, an empty |
79 | string is returned. | |
80 | ||
a660d684 | 81 | |
dcbd177f | 82 | \membersection{wxPathList::FindValidPath}\label{wxpathlistfindvalidpath} |
a660d684 | 83 | |
8daf3c36 | 84 | \constfunc{wxString}{FindValidPath}{\param{const wxString\& }{file}} |
a660d684 | 85 | |
31a8bf3f RR |
86 | Searches for a path for an existing file by appending {\it file} to |
87 | successive members of the path list. | |
88 | If the file wasn't found, an empty string is returned. | |
89 | ||
90 | The returned path may be relative to the current working directory. | |
4d01e350 | 91 | |
31a8bf3f RR |
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. |