]>
Commit | Line | Data |
---|---|---|
2569938d VZ |
1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
2 | %% Name: filename.tex | |
3 | %% Purpose: wxFileName documentation | |
4 | %% Author: Vadim Zeitlin | |
5 | %% Modified by: | |
6 | %% Created: 30.11.01 | |
7 | %% RCS-ID: $Id$ | |
8 | %% Copyright: (c) 2001 Vadim Zeitlin | |
8795498c | 9 | %% License: wxWindows license |
2569938d VZ |
10 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
11 | ||
12 | \section{\class{wxFileName}}\label{wxfilename} | |
13 | ||
14 | wxFileName encapsulates a file name. This class serves two purposes: first, it | |
15 | provides the functions to split the file names into components and to recombine | |
16 | these components in the full file name which can then be passed to the OS file | |
fc2171bd | 17 | functions (and \helpref{wxWidgets functions}{filefunctions} wrapping them). |
2569938d | 18 | Second, it includes the functions for working with the files itself. Note that |
95c00185 | 19 | to change the file data you should use \helpref{wxFile}{wxfile} class instead. |
2569938d VZ |
20 | wxFileName provides functions for working with the file attributes. |
21 | ||
22 | \wxheading{Derived from} | |
23 | ||
24 | No base class | |
25 | ||
93ab511d VZ |
26 | \wxheading{Include files} |
27 | ||
28 | <wx/filename.h> | |
29 | ||
2569938d VZ |
30 | \wxheading{Data structures} |
31 | ||
32 | Many wxFileName methods accept the path format argument which is by\rtfsp | |
33 | {\tt wxPATH\_NATIVE} by default meaning to use the path format native for the | |
34 | current platform. | |
35 | ||
36 | The path format affects the operation of wxFileName functions in several ways: | |
37 | first and foremost, it defines the path separator character to use, but it also | |
38 | affects other things such as whether the path has the drive part or not. | |
39 | ||
40 | \begin{verbatim} | |
41 | enum wxPathFormat | |
42 | { | |
43 | wxPATH_NATIVE = 0, // the path format for the current platform | |
44 | wxPATH_UNIX, | |
f363e05c | 45 | wxPATH_BEOS = wxPATH_UNIX, |
2569938d VZ |
46 | wxPATH_MAC, |
47 | wxPATH_DOS, | |
f363e05c VZ |
48 | wxPATH_WIN = wxPATH_DOS, |
49 | wxPATH_OS2 = wxPATH_DOS, | |
2569938d VZ |
50 | wxPATH_VMS, |
51 | ||
f363e05c | 52 | wxPATH_MAX // Not a valid value for specifying path format |
2569938d VZ |
53 | } |
54 | \end{verbatim} | |
55 | ||
6f91bc33 VZ |
56 | \latexignore{\rtfignore{\wxheading{Function groups}}} |
57 | ||
5bb9aeb2 | 58 | |
f0e8a2d0 | 59 | \membersection{File name format}\label{filenameformat} |
6f91bc33 VZ |
60 | |
61 | wxFileName currently supports the file names in the Unix, DOS/Windows, Mac OS | |
62 | and VMS formats. Although these formats are quite different, wxFileName tries | |
2edb0bde | 63 | to treat them all in the same generic way. It supposes that all file names |
6f91bc33 VZ |
64 | consist of the following parts: the volume (also known as drive under Windows |
65 | or device under VMS), the path which is a sequence of directory names separated | |
66 | by the \helpref{path separators}{wxfilenamegetpathseparators} and the full | |
67 | filename itself which, in turn, is composed from the base file name and the | |
68 | extension. All of the individual components of the file name may be empty and, | |
69 | for example, the volume name is always empty under Unix, but if they are all | |
70 | empty simultaneously, the filename object is considered to be in an invalid | |
0894707e | 71 | state and \helpref{IsOk}{wxfilenameisok} returns {\tt false} for it. |
6f91bc33 VZ |
72 | |
73 | File names can be case-sensitive or not, the function\rtfsp | |
74 | \helpref{IsCaseSensitive}{wxfilenameiscasesensitive} allows to determine this. | |
75 | ||
47ce5c4a VZ |
76 | The rules for determining whether the file name is absolute or relative also |
77 | depend on the file name format and the only portable way to answer this | |
78 | question is to use \helpref{IsAbsolute}{wxfilenameisabsolute} or\rtfsp | |
79 | \helpref{IsRelative}{wxfilenameisrelative} method. Note that on Windows, "X:" | |
80 | refers to the current working directory on drive X. Therefore, a wxFileName | |
81 | instance constructed from for example "X:dir/file.ext" treats the portion | |
82 | beyond drive separator as being relative to that directory. | |
83 | ||
84 | To ensure that the filename is absolute, you may use\rtfsp | |
85 | \helpref{MakeAbsolute}{wxfilenamemakeabsolute}. There is also an inverse | |
86 | function \helpref{MakeRelativeTo}{wxfilenamemakerelativeto} which undoes | |
87 | what \helpref{Normalize(wxPATH\_NORM\_DOTS)}{wxfilenamenormalize} does. | |
6f91bc33 VZ |
88 | |
89 | Other functions returning information about the file format provided by this | |
90 | class are \helpref{GetVolumeSeparator}{wxfilenamegetvolumeseparator},\rtfsp | |
2db991f4 | 91 | \helpref{IsPathSeparator}{wxfilenameispathseparator}. |
6f91bc33 | 92 | |
5bb9aeb2 | 93 | |
f0e8a2d0 | 94 | \membersection{File name construction}\label{filenameconstruction} |
6f91bc33 | 95 | |
3ff07edb RR |
96 | You can initialize a wxFileName instance using one of the following functions: |
97 | ||
98 | \helpref{wxFileName constructors}{wxfilenamewxfilename}\\ | |
99 | \helpref{Assign}{wxfilenameassign}\\ | |
100 | \helpref{AssignCwd}{wxfilenameassigncwd}\\ | |
101 | \helpref{AssignDir}{wxfilenameassigndir}\\ | |
102 | \helpref{AssignHomeDir}{wxfilenameassignhomedir}\\ | |
103 | \helpref{AssignHomeTempFileName}{wxfilenameassigntempfilename}\\ | |
104 | \helpref{operator $=$}{wxfilenameoperatorassign} | |
6f91bc33 | 105 | |
5bb9aeb2 | 106 | |
f0e8a2d0 | 107 | \membersection{File tests}\label{filetests} |
6f91bc33 | 108 | |
47ce5c4a VZ |
109 | Before doing other tests, you should use \helpref{IsOk}{wxfilenameisok} to |
110 | verify that the filename is well defined. If it is,\rtfsp | |
111 | \helpref{FileExists}{wxfilenamefileexists} can be used to test whether a file | |
112 | with such name exists and \helpref{DirExists}{wxfilenamedirexists} can be used | |
113 | to test for directory existence. | |
6f91bc33 VZ |
114 | |
115 | File names should be compared using \helpref{SameAs}{wxfilenamesameas} method | |
3ff07edb RR |
116 | or \helpref{operator $==$}{wxfilenameoperatorequal}. |
117 | ||
118 | For testing basic access modes, you can use: | |
119 | ||
120 | \helpref{IsDirWritable}{wxfilenameisdirwritable}\\ | |
121 | \helpref{IsDirReadable}{wxfilenameisdirreadable}\\ | |
122 | \helpref{IsFileWritable}{wxfilenameisfilewritable}\\ | |
123 | \helpref{IsFileReadable}{wxfilenameisfilereadable}\\ | |
124 | \helpref{IsFileExecutable}{wxfilenameisfileexecutable} | |
6f91bc33 | 125 | |
5bb9aeb2 | 126 | |
f0e8a2d0 | 127 | \membersection{File name components}\label{filenamecomponents} |
6f91bc33 | 128 | |
2458d90b VZ |
129 | These functions allow to examine and modify the individual directories of the |
130 | path: | |
6f91bc33 VZ |
131 | |
132 | \helpref{AppendDir}{wxfilenameappenddir}\\ | |
133 | \helpref{InsertDir}{wxfilenameinsertdir}\\ | |
134 | \helpref{GetDirCount}{wxfilenamegetdircount} | |
135 | \helpref{PrependDir}{wxfilenameprependdir}\\ | |
2458d90b VZ |
136 | \helpref{RemoveDir}{wxfilenameremovedir}\\ |
137 | \helpref{RemoveLastDir}{wxfilenameremovelastdir} | |
6f91bc33 VZ |
138 | |
139 | To change the components of the file name individually you can use the | |
140 | following functions: | |
141 | ||
142 | \helpref{GetExt}{wxfilenamegetext}\\ | |
143 | \helpref{GetName}{wxfilenamegetname}\\ | |
144 | \helpref{GetVolume}{wxfilenamegetvolume}\\ | |
145 | \helpref{HasExt}{wxfilenamehasext}\\ | |
146 | \helpref{HasName}{wxfilenamehasname}\\ | |
147 | \helpref{HasVolume}{wxfilenamehasvolume}\\ | |
148 | \helpref{SetExt}{wxfilenamesetext}\\ | |
0b40f3d8 RR |
149 | \helpref{ClearExt}{wxfilenameclearext}\\ |
150 | \helpref{SetEmptyExt}{wxfilenamesetemptyext}\\ | |
6f91bc33 VZ |
151 | \helpref{SetName}{wxfilenamesetname}\\ |
152 | \helpref{SetVolume}{wxfilenamesetvolume}\\ | |
153 | ||
5bb9aeb2 | 154 | |
f0e8a2d0 | 155 | \membersection{Operations}\label{filenameoperations} |
6f91bc33 VZ |
156 | |
157 | These methods allow to work with the file creation, access and modification | |
6dbb903b VZ |
158 | times. Note that not all filesystems under all platforms implement these times |
159 | in the same way. For example, the access time under Windows has a resolution of | |
160 | one day (so it is really the access date and not time). The access time may be | |
161 | updated when the file is executed or not depending on the platform. | |
6f91bc33 VZ |
162 | |
163 | \helpref{GetModificationTime}{wxfilenamegetmodificationtime}\\ | |
164 | \helpref{GetTimes}{wxfilenamegettimes}\\ | |
165 | \helpref{SetTimes}{wxfilenamesettimes}\\ | |
166 | \helpref{Touch}{wxfilenametouch} | |
167 | ||
168 | Other file system operations functions are: | |
169 | ||
170 | \helpref{Mkdir}{wxfilenamemkdir}\\ | |
171 | \helpref{Rmdir}{wxfilenamermdir} | |
172 | ||
2569938d VZ |
173 | \latexignore{\rtfignore{\wxheading{Members}}} |
174 | ||
5bb9aeb2 | 175 | |
6f91bc33 | 176 | \membersection{wxFileName::wxFileName}\label{wxfilenamewxfilename} |
2569938d VZ |
177 | |
178 | \func{}{wxFileName}{\void} | |
179 | ||
180 | Default constructor. | |
181 | ||
2569938d VZ |
182 | \func{}{wxFileName}{\param{const wxFileName\& }{filename}} |
183 | ||
184 | Copy constructor. | |
185 | ||
2569938d VZ |
186 | \func{}{wxFileName}{\param{const wxString\& }{fullpath}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} |
187 | ||
95c00185 | 188 | Constructor taking a full filename. If it terminates with a '/', a directory path |
2edb0bde | 189 | is constructed (the name will be empty), otherwise a file name and |
95c00185 | 190 | extension are extracted from it. |
2569938d | 191 | |
2569938d VZ |
192 | \func{}{wxFileName}{\param{const wxString\& }{path}, \param{const wxString\& }{name}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} |
193 | ||
6f91bc33 | 194 | Constructor from a directory name and a file name. |
2569938d VZ |
195 | |
196 | \func{}{wxFileName}{\param{const wxString\& }{path}, \param{const wxString\& }{name}, \param{const wxString\& }{ext}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} | |
197 | ||
95c00185 | 198 | Constructor from a directory name, base file name and extension. |
81f25632 VZ |
199 | |
200 | \func{}{wxFileName}{\param{const wxString\& }{volume}, \param{const wxString\& }{path}, \param{const wxString\& }{name}, \param{const wxString\& }{ext}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} | |
201 | ||
95c00185 | 202 | Constructor from a volume name, a directory name, base file name and extension. |
2569938d | 203 | |
5bb9aeb2 | 204 | |
2569938d VZ |
205 | \membersection{wxFileName::AppendDir}\label{wxfilenameappenddir} |
206 | ||
207 | \func{void}{AppendDir}{\param{const wxString\& }{dir}} | |
208 | ||
5bb9aeb2 VZ |
209 | Appends a directory component to the path. This component should contain a |
210 | single directory name level, i.e. not contain any path or volume separators nor | |
211 | should it be empty, otherwise the function does nothing (and generates an | |
212 | assert failure in debug build). | |
213 | ||
2569938d VZ |
214 | |
215 | \membersection{wxFileName::Assign}\label{wxfilenameassign} | |
216 | ||
217 | \func{void}{Assign}{\param{const wxFileName\& }{filepath}} | |
218 | ||
2569938d VZ |
219 | \func{void}{Assign}{\param{const wxString\& }{fullpath}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} |
220 | ||
dfecbee5 VZ |
221 | \func{void}{Assign}{\param{const wxString\& }{volume}, \param{const wxString\& }{path}, \param{const wxString\& }{name}, \param{const wxString\& }{ext}, \param{bool }{hasExt}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} |
222 | ||
2569938d VZ |
223 | \func{void}{Assign}{\param{const wxString\& }{volume}, \param{const wxString\& }{path}, \param{const wxString\& }{name}, \param{const wxString\& }{ext}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} |
224 | ||
2569938d VZ |
225 | \func{void}{Assign}{\param{const wxString\& }{path}, \param{const wxString\& }{name}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} |
226 | ||
2569938d VZ |
227 | \func{void}{Assign}{\param{const wxString\& }{path}, \param{const wxString\& }{name}, \param{const wxString\& }{ext}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} |
228 | ||
95c00185 | 229 | Creates the file name from various combinations of data. |
2569938d | 230 | |
5bb9aeb2 | 231 | |
2569938d VZ |
232 | \membersection{wxFileName::AssignCwd}\label{wxfilenameassigncwd} |
233 | ||
f363e05c | 234 | \func{static void}{AssignCwd}{\param{const wxString\& }{volume = wxEmptyString}} |
6f91bc33 VZ |
235 | |
236 | Makes this object refer to the current working directory on the specified | |
237 | volume (or current volume if {\it volume} is empty). | |
2569938d | 238 | |
6f91bc33 | 239 | \wxheading{See also} |
2569938d | 240 | |
6f91bc33 | 241 | \helpref{GetCwd}{wxfilenamegetcwd} |
2569938d | 242 | |
5bb9aeb2 | 243 | |
2569938d VZ |
244 | \membersection{wxFileName::AssignDir}\label{wxfilenameassigndir} |
245 | ||
246 | \func{void}{AssignDir}{\param{const wxString\& }{dir}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} | |
247 | ||
95c00185 | 248 | Sets this file name object to the given directory name. The name and extension |
81f25632 | 249 | will be empty. |
2569938d | 250 | |
5bb9aeb2 | 251 | |
2569938d VZ |
252 | \membersection{wxFileName::AssignHomeDir}\label{wxfilenameassignhomedir} |
253 | ||
254 | \func{void}{AssignHomeDir}{\void} | |
255 | ||
95c00185 | 256 | Sets this file name object to the home directory. |
2569938d | 257 | |
5bb9aeb2 | 258 | |
2569938d VZ |
259 | \membersection{wxFileName::AssignTempFileName}\label{wxfilenameassigntempfilename} |
260 | ||
df22f860 | 261 | \func{void}{AssignTempFileName}{\param{const wxString\& }{prefix}, \param{wxFile *}{fileTemp = {\tt NULL}}} |
2569938d | 262 | |
ade35f11 VZ |
263 | The function calls \helpref{CreateTempFileName}{wxfilenamecreatetempfilename} to |
264 | create a temporary file and sets this object to the name of the file. If a | |
265 | temporary file couldn't be created, the object is put into the\rtfsp | |
266 | \helpref{invalid}{wxfilenameisok} state. | |
2569938d | 267 | |
5bb9aeb2 | 268 | |
2569938d VZ |
269 | \membersection{wxFileName::Clear}\label{wxfilenameclear} |
270 | ||
271 | \func{void}{Clear}{\void} | |
272 | ||
ade35f11 VZ |
273 | Reset all components to default, uninitialized state. |
274 | ||
5bb9aeb2 | 275 | |
0b40f3d8 RR |
276 | \membersection{wxFileName::ClearExt}\label{wxfilenameclearext} |
277 | ||
278 | \func{void}{SetClearExt}{\void} | |
279 | ||
280 | Removes the extension from the file name resulting in a | |
281 | file name with no trailing dot. | |
282 | ||
283 | \wxheading{See also} | |
284 | ||
285 | \helpref{SetExt}{wxfilenamesetext} | |
286 | \helpref{SetEmptyExt}{wxfilenamesetemptyext} | |
287 | ||
02a3b391 | 288 | \membersection{wxFileName::CreateTempFileName}\label{wxfilenamecreatetempfilename} |
ade35f11 | 289 | |
df22f860 | 290 | \func{static wxString}{CreateTempFileName}{\param{const wxString\& }{prefix}, \param{wxFile *}{fileTemp = {\tt NULL}}} |
ade35f11 VZ |
291 | |
292 | Returns a temporary file name starting with the given {\it prefix}. If | |
293 | the {\it prefix} is an absolute path, the temporary file is created in this | |
294 | directory, otherwise it is created in the default system directory for the | |
295 | temporary files or in the current directory. | |
2569938d | 296 | |
df22f860 VZ |
297 | If the function succeeds, the temporary file is actually created. If\rtfsp |
298 | {\it fileTemp} is not {\tt NULL}, this file will be opened using the name of | |
299 | the temporary file. When possible, this is done in an atomic way ensuring that | |
300 | no race condition occurs between the temporary file name generation and opening | |
301 | it which could often lead to security compromise on the multiuser systems. | |
302 | If {\it fileTemp} is {\tt NULL}, the file is only created, but not opened. | |
303 | ||
304 | Under Unix, the temporary file will have read and write permissions for the | |
305 | owner only to minimize the security problems. | |
306 | ||
307 | \wxheading{Parameters} | |
308 | ||
309 | \docparam{prefix}{Prefix to use for the temporary file name construction} | |
310 | ||
311 | \docparam{fileTemp}{The file to open or {\tt NULL} to just get the name} | |
ade35f11 VZ |
312 | |
313 | \wxheading{Return value} | |
314 | ||
315 | The full temporary file name or an empty string on error. | |
2569938d | 316 | |
5bb9aeb2 | 317 | |
2569938d VZ |
318 | \membersection{wxFileName::DirExists}\label{wxfilenamedirexists} |
319 | ||
8e41796c | 320 | \constfunc{bool}{DirExists}{\void} |
2569938d | 321 | |
8e41796c | 322 | \func{static bool}{DirExists}{\param{const wxString\& }{dir}} |
2569938d | 323 | |
f363e05c | 324 | Returns {\tt true} if the directory with this name exists. |
2569938d | 325 | |
5bb9aeb2 | 326 | |
2569938d VZ |
327 | \membersection{wxFileName::DirName}\label{wxfilenamedirname} |
328 | ||
520200fd VZ |
329 | \func{static wxFileName}{DirName}{\param{const wxString\& }{dir}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} |
330 | ||
331 | Returns the object corresponding to the directory with the given name. | |
332 | The {\it dir} parameter may have trailing path separator or not. | |
2569938d | 333 | |
95c00185 | 334 | |
5bb9aeb2 | 335 | |
2569938d VZ |
336 | \membersection{wxFileName::FileExists}\label{wxfilenamefileexists} |
337 | ||
8e41796c | 338 | \constfunc{bool}{FileExists}{\void} |
2569938d | 339 | |
8e41796c | 340 | \func{static bool}{FileExists}{\param{const wxString\& }{file}} |
2569938d | 341 | |
f363e05c | 342 | Returns {\tt true} if the file with this name exists. |
2569938d | 343 | |
8e41796c VZ |
344 | \wxheading{See also} |
345 | ||
346 | \helpref{DirExists}{wxfilenamedirexists} | |
347 | ||
520200fd | 348 | |
5bb9aeb2 | 349 | |
2569938d VZ |
350 | \membersection{wxFileName::FileName}\label{wxfilenamefilename} |
351 | ||
520200fd VZ |
352 | \func{static wxFileName}{FileName}{\param{const wxString\& }{file}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} |
353 | ||
354 | Returns the file name object corresponding to the given {\it file}. This | |
355 | function exists mainly for symmetry with \helpref{DirName}{wxfilenamedirname}. | |
2569938d | 356 | |
2569938d | 357 | |
5bb9aeb2 | 358 | |
2569938d VZ |
359 | \membersection{wxFileName::GetCwd}\label{wxfilenamegetcwd} |
360 | ||
f363e05c | 361 | \func{static wxString}{GetCwd}{\param{const wxString\& }{volume = ""}} |
6f91bc33 | 362 | |
95c00185 | 363 | Retrieves the value of the current working directory on the specified volume. If |
43e8916f | 364 | the volume is empty, the program's current working directory is returned for the |
6f91bc33 VZ |
365 | current volume. |
366 | ||
367 | \wxheading{Return value} | |
368 | ||
369 | The string containing the current working directory or an empty string on | |
370 | error. | |
2569938d | 371 | |
6f91bc33 VZ |
372 | \wxheading{See also} |
373 | ||
374 | \helpref{AssignCwd}{wxfilenameassigncwd} | |
2569938d | 375 | |
5bb9aeb2 | 376 | |
2569938d VZ |
377 | \membersection{wxFileName::GetDirCount}\label{wxfilenamegetdircount} |
378 | ||
379 | \constfunc{size\_t}{GetDirCount}{\void} | |
380 | ||
95c00185 | 381 | Returns the number of directories in the file name. |
2569938d | 382 | |
5bb9aeb2 | 383 | |
2569938d VZ |
384 | \membersection{wxFileName::GetDirs}\label{wxfilenamegetdirs} |
385 | ||
386 | \constfunc{const wxArrayString\&}{GetDirs}{\void} | |
387 | ||
95c00185 | 388 | Returns the directories in string array form. |
2569938d | 389 | |
5bb9aeb2 | 390 | |
2569938d VZ |
391 | \membersection{wxFileName::GetExt}\label{wxfilenamegetext} |
392 | ||
393 | \constfunc{wxString}{GetExt}{\void} | |
394 | ||
95c00185 | 395 | Returns the file name extension. |
2569938d | 396 | |
5bb9aeb2 | 397 | |
f363e05c VZ |
398 | \membersection{wxFileName::GetForbiddenChars}\label{wxfilenamegetforbiddenchars} |
399 | ||
400 | \func{static wxString}{GetForbiddenChars}{\param{wxPathFormat }{format = wxPATH\_NATIVE}} | |
401 | ||
402 | Returns the characters that can't be used in filenames and directory names for the specified format. | |
403 | ||
5bb9aeb2 | 404 | |
2569938d VZ |
405 | \membersection{wxFileName::GetFormat}\label{wxfilenamegetformat} |
406 | ||
f363e05c | 407 | \func{static wxPathFormat}{GetFormat}{\param{wxPathFormat }{format = wxPATH\_NATIVE}} |
2569938d | 408 | |
95c00185 | 409 | Returns the canonical path format for this platform. |
2569938d | 410 | |
5bb9aeb2 | 411 | |
2569938d VZ |
412 | \membersection{wxFileName::GetFullName}\label{wxfilenamegetfullname} |
413 | ||
414 | \constfunc{wxString}{GetFullName}{\void} | |
415 | ||
95c00185 | 416 | Returns the full name (including extension but excluding directories). |
2569938d | 417 | |
5bb9aeb2 | 418 | |
2569938d VZ |
419 | \membersection{wxFileName::GetFullPath}\label{wxfilenamegetfullpath} |
420 | ||
421 | \constfunc{wxString}{GetFullPath}{\param{wxPathFormat }{format = wxPATH\_NATIVE}} | |
422 | ||
95c00185 | 423 | Returns the full path with name and extension. |
2569938d | 424 | |
5bb9aeb2 | 425 | |
2569938d VZ |
426 | \membersection{wxFileName::GetHomeDir}\label{wxfilenamegethomedir} |
427 | ||
f363e05c | 428 | \func{static wxString}{GetHomeDir}{\void} |
2569938d | 429 | |
95c00185 | 430 | Returns the home directory. |
2569938d | 431 | |
5bb9aeb2 | 432 | |
2569938d VZ |
433 | \membersection{wxFileName::GetLongPath}\label{wxfilenamegetlongpath} |
434 | ||
435 | \constfunc{wxString}{GetLongPath}{\void} | |
436 | ||
437 | Return the long form of the path (returns identity on non-Windows platforms) | |
438 | ||
5bb9aeb2 | 439 | |
2569938d VZ |
440 | \membersection{wxFileName::GetModificationTime}\label{wxfilenamegetmodificationtime} |
441 | ||
442 | \constfunc{wxDateTime}{GetModificationTime}{\void} | |
443 | ||
95c00185 | 444 | Returns the last time the file was last modified. |
2569938d | 445 | |
5bb9aeb2 | 446 | |
2569938d VZ |
447 | \membersection{wxFileName::GetName}\label{wxfilenamegetname} |
448 | ||
449 | \constfunc{wxString}{GetName}{\void} | |
450 | ||
4e43c815 VZ |
451 | Returns the name part of the filename (without extension). |
452 | ||
453 | \wxheading{See also} | |
454 | ||
455 | \helpref{GetFullName}{wxfilenamegetfullname} | |
456 | ||
2569938d | 457 | |
5bb9aeb2 | 458 | |
2569938d VZ |
459 | \membersection{wxFileName::GetPath}\label{wxfilenamegetpath} |
460 | ||
93fa67c0 | 461 | \constfunc{wxString}{GetPath}{\param{int }{flags = {\tt wxPATH\_GET\_VOLUME}}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} |
2569938d | 462 | |
95c00185 | 463 | Returns the path part of the filename (without the name or extension). The |
33b97389 | 464 | possible flags values are: |
2569938d | 465 | |
d1853d47 | 466 | \twocolwidtha{5cm} |
33b97389 | 467 | \begin{twocollist}\itemsep=0pt |
d1853d47 | 468 | \twocolitem{{\bf wxPATH\_GET\_VOLUME}}{Return the path with the volume (does |
93fa67c0 VZ |
469 | nothing for the filename formats without volumes), otherwise the path without |
470 | volume part is returned.} | |
d1853d47 | 471 | \twocolitem{{\bf wxPATH\_GET\_SEPARATOR}}{Return the path with the trailing |
33b97389 VZ |
472 | separator, if this flag is not given there will be no separator at the end of |
473 | the path.} | |
474 | \end{twocollist} | |
475 | ||
5bb9aeb2 | 476 | |
33b97389 VZ |
477 | \membersection{wxFileName::GetPathSeparator}\label{wxfilenamegetpathseparator} |
478 | ||
f363e05c | 479 | \func{static wxChar}{GetPathSeparator}{\param{wxPathFormat }{format = wxPATH\_NATIVE}} |
33b97389 | 480 | |
95c00185 | 481 | Returns the usually used path separator for this format. For all formats but |
33b97389 VZ |
482 | {\tt wxPATH\_DOS} there is only one path separator anyhow, but for DOS there |
483 | are two of them and the native one, i.e. the backslash is returned by this | |
484 | method. | |
485 | ||
486 | \wxheading{See also} | |
487 | ||
488 | \helpref{GetPathSeparators}{wxfilenamegetpathseparators} | |
2569938d | 489 | |
5bb9aeb2 | 490 | |
2569938d VZ |
491 | \membersection{wxFileName::GetPathSeparators}\label{wxfilenamegetpathseparators} |
492 | ||
f363e05c | 493 | \func{static wxString}{GetPathSeparators}{\param{wxPathFormat }{format = wxPATH\_NATIVE}} |
2569938d | 494 | |
95c00185 | 495 | Returns the string containing all the path separators for this format. For all |
33b97389 | 496 | formats but {\tt wxPATH\_DOS} this string contains only one character but for |
7af3ca16 | 497 | DOS and Windows both {\tt '/'} and {\tt '\textbackslash'} may be used as |
33b97389 VZ |
498 | separators. |
499 | ||
500 | \wxheading{See also} | |
2569938d | 501 | |
33b97389 | 502 | \helpref{GetPathSeparator}{wxfilenamegetpathseparator} |
2569938d | 503 | |
5bb9aeb2 | 504 | |
f1e77933 VZ |
505 | \membersection{wxFileName::GetPathTerminators}\label{wxfilenamegetpathterminators} |
506 | ||
507 | \func{static wxString}{GetPathTerminators}{\param{wxPathFormat }{format = wxPATH\_NATIVE}} | |
508 | ||
509 | Returns the string of characters which may terminate the path part. This is the | |
510 | same as \helpref{GetPathSeparators}{wxfilenamegetpathseparators} except for VMS | |
511 | path format where $]$ is used at the end of the path part. | |
512 | ||
513 | ||
8b4b9395 VZ |
514 | \membersection{wxFileName::GetPathWithSep}\label{wxfilenamegetpathwithsep} |
515 | ||
516 | \constfunc{wxString}{GetPathWithSep}{\param{wxPathFormat }{format = wxPATH\_NATIVE}} | |
517 | ||
518 | Returns the path with the trailing separator, useful for appending the name to | |
519 | the given path. | |
520 | ||
521 | This is the same as calling \helpref{GetPath}{wxfilenamegetpath} | |
522 | \texttt{(wxPATH\_GET\_VOLUME | wxPATH\_GET\_SEPARATOR, format)}. | |
523 | ||
524 | ||
2569938d VZ |
525 | \membersection{wxFileName::GetShortPath}\label{wxfilenamegetshortpath} |
526 | ||
527 | \constfunc{wxString}{GetShortPath}{\void} | |
528 | ||
95c00185 | 529 | Return the short form of the path (returns identity on non-Windows platforms). |
2569938d | 530 | |
5bb9aeb2 | 531 | |
23b8a262 JS |
532 | \membersection{wxFileName::GetSize}\label{wxfilenamegetsize} |
533 | ||
534 | \constfunc{wxULongLong}{GetSize}{\void} | |
535 | ||
536 | \func{static wxULongLong}{GetSize}{\param{const wxString\& }{filename}} | |
537 | ||
538 | Returns the size of this file (first form) or the size of the given file (second form). | |
539 | If the file does not exist or its size could not be read (because e.g. the file is locked | |
540 | by another process) the returned value is {\tt wxInvalidSize}. | |
541 | ||
542 | ||
543 | \membersection{wxFileName::GetHumanReadableSize}\label{wxfilenamegethumanreadablesize} | |
544 | ||
545 | \constfunc{wxString}{GetHumanReadableSize}{\param{const wxString\& }{failmsg = "Not available"}, \param{int }{precision = 1}} | |
546 | ||
547 | \func{static wxString}{GetHumanReadableSize}{\param{const wxULongLong\& }{bytes}, \param{const wxString\& }{nullsize = "Not available"}, \param{int }{precision = 1}} | |
548 | ||
549 | Returns the size of this file (first form) or the given number of bytes (second form) | |
550 | in a human-readable form. | |
551 | ||
552 | If the size could not be retrieved the {\tt failmsg} string is returned (first form). | |
553 | If {\tt bytes} is {\tt wxInvalidSize} or zero, then {\tt nullsize} is returned (second form). | |
554 | ||
555 | In case of success, the returned string is a floating-point number with {\tt precision} decimal digits | |
556 | followed by the size unit (B, kB, MB, GB, TB: respectively bytes, kilobytes, megabytes, gigabytes, terabytes). | |
557 | ||
558 | ||
8d7d6dea JS |
559 | \membersection{wxFileName::GetTempDir}\label{wxfilenamegettempdir} |
560 | ||
561 | \func{static wxString}{GetTempDir}{\void} | |
562 | ||
563 | Returns the directory used for temporary files. | |
564 | ||
565 | ||
2569938d VZ |
566 | \membersection{wxFileName::GetTimes}\label{wxfilenamegettimes} |
567 | ||
6dbb903b | 568 | \constfunc{bool}{GetTimes}{\param{wxDateTime* }{dtAccess}, \param{wxDateTime* }{dtMod}, \param{wxDateTime* }{dtCreate}} |
2569938d | 569 | |
95c00185 | 570 | Returns the last access, last modification and creation times. The last access |
ebb39671 VZ |
571 | time is updated whenever the file is read or written (or executed in the case |
572 | of Windows), last modification time is only changed when the file is written | |
573 | to. Finally, the creation time is indeed the time when the file was created | |
574 | under Windows and the inode change time under Unix (as it is impossible to | |
575 | retrieve the real file creation time there anyhow) which can also be changed | |
576 | by many operations after the file creation. | |
2569938d | 577 | |
95c00185 | 578 | Any of the pointers may be {\tt NULL} if the corresponding time is not |
ebb39671 VZ |
579 | needed. |
580 | ||
581 | \wxheading{Return value} | |
582 | ||
0894707e | 583 | {\tt true} on success, {\tt false} if we failed to retrieve the times. |
2569938d | 584 | |
5bb9aeb2 | 585 | |
2569938d VZ |
586 | \membersection{wxFileName::GetVolume}\label{wxfilenamegetvolume} |
587 | ||
588 | \constfunc{wxString}{GetVolume}{\void} | |
589 | ||
f70c0443 | 590 | Returns the string containing the volume for this file name, empty if it |
ebb39671 VZ |
591 | doesn't have one or if the file system doesn't support volumes at all (for |
592 | example, Unix). | |
2569938d | 593 | |
5bb9aeb2 | 594 | |
2569938d VZ |
595 | \membersection{wxFileName::GetVolumeSeparator}\label{wxfilenamegetvolumeseparator} |
596 | ||
f363e05c | 597 | \func{static wxString}{GetVolumeSeparator}{\param{wxPathFormat }{format = wxPATH\_NATIVE}} |
2569938d | 598 | |
95c00185 | 599 | Returns the string separating the volume from the path for this format. |
2569938d | 600 | |
5bb9aeb2 | 601 | |
2569938d VZ |
602 | \membersection{wxFileName::HasExt}\label{wxfilenamehasext} |
603 | ||
604 | \constfunc{bool}{HasExt}{\void} | |
605 | ||
f363e05c | 606 | Returns {\tt true} if an extension is present. |
2569938d | 607 | |
5bb9aeb2 | 608 | |
2569938d VZ |
609 | \membersection{wxFileName::HasName}\label{wxfilenamehasname} |
610 | ||
611 | \constfunc{bool}{HasName}{\void} | |
612 | ||
f363e05c | 613 | Returns {\tt true} if a name is present. |
2569938d | 614 | |
5bb9aeb2 | 615 | |
2569938d VZ |
616 | \membersection{wxFileName::HasVolume}\label{wxfilenamehasvolume} |
617 | ||
618 | \constfunc{bool}{HasVolume}{\void} | |
619 | ||
f363e05c | 620 | Returns {\tt true} if a volume specifier is present. |
2569938d | 621 | |
5bb9aeb2 | 622 | |
2569938d VZ |
623 | \membersection{wxFileName::InsertDir}\label{wxfilenameinsertdir} |
624 | ||
2458d90b | 625 | \func{void}{InsertDir}{\param{size\_t }{before}, \param{const wxString\& }{dir}} |
2569938d | 626 | |
5bb9aeb2 VZ |
627 | Inserts a directory component before the zero-based position in the directory |
628 | list. Please see \helpref{AppendDir}{wxfilenameappenddir} for important notes. | |
629 | ||
2569938d VZ |
630 | |
631 | \membersection{wxFileName::IsAbsolute}\label{wxfilenameisabsolute} | |
632 | ||
633 | \func{bool}{IsAbsolute}{\param{wxPathFormat }{format = wxPATH\_NATIVE}} | |
634 | ||
f363e05c | 635 | Returns {\tt true} if this filename is absolute. |
2569938d | 636 | |
5bb9aeb2 | 637 | |
2569938d VZ |
638 | \membersection{wxFileName::IsCaseSensitive}\label{wxfilenameiscasesensitive} |
639 | ||
f363e05c | 640 | \func{static bool}{IsCaseSensitive}{\param{wxPathFormat }{format = wxPATH\_NATIVE}} |
2569938d | 641 | |
f363e05c | 642 | Returns {\tt true} if the file names of this type are case-sensitive. |
2569938d | 643 | |
5bb9aeb2 | 644 | |
3ff07edb RR |
645 | \membersection{wxFileName::IsDirReadable}\label{wxfilenameisdirreadable} |
646 | ||
647 | \constfunc{bool}{IsDirReadable}{\void} | |
648 | ||
649 | \func{static bool}{IsDirReadable}{\param{const wxString\& }{dir}} | |
650 | ||
651 | Returns {\tt true} if the directory component of this instance (or given \arg{dir}) | |
652 | is an existing directory and this process has read permissions on it. | |
653 | Read permissions on a directory mean that you can list the directory contents but it | |
654 | doesn't imply that you have read permissions on the files contained. | |
655 | ||
656 | ||
657 | \membersection{wxFileName::IsDirWritable}\label{wxfilenameisdirwritable} | |
658 | ||
659 | \constfunc{bool}{IsDirWritable}{\void} | |
660 | ||
661 | \func{static bool}{IsDirWritable}{\param{const wxString\& }{dir}} | |
662 | ||
663 | Returns {\tt true} if the directory component of this instance (or given \arg{dir}) | |
664 | is an existing directory and this process has write permissions on it. | |
665 | Write permissions on a directory mean that you can create new files in the directory. | |
666 | ||
667 | ||
668 | \membersection{wxFileName::IsFileExecutable}\label{wxfilenameisfileexecutable} | |
669 | ||
670 | \constfunc{bool}{IsFileExecutable}{\void} | |
671 | ||
672 | \func{static bool}{IsFileExecutable}{\param{const wxString\& }{file}} | |
673 | ||
674 | Returns {\tt true} if a file with this name exists and if this process has execute permissions on it. | |
675 | ||
676 | ||
677 | \membersection{wxFileName::IsFileReadable}\label{wxfilenameisfilereadable} | |
678 | ||
679 | \constfunc{bool}{IsFileReadable}{\void} | |
680 | ||
681 | \func{static bool}{IsFileReadable}{\param{const wxString\& }{file}} | |
682 | ||
683 | Returns {\tt true} if a file with this name exists and if this process has read permissions on it. | |
684 | ||
685 | ||
686 | \membersection{wxFileName::IsFileWritable}\label{wxfilenameisfilewritable} | |
687 | ||
688 | \constfunc{bool}{IsFileWritable}{\void} | |
689 | ||
690 | \func{static bool}{IsFileWritable}{\param{const wxString\& }{file}} | |
691 | ||
692 | Returns {\tt true} if a file with this name exists and if this process has write permissions on it. | |
693 | ||
694 | ||
2569938d VZ |
695 | \membersection{wxFileName::IsOk}\label{wxfilenameisok} |
696 | ||
697 | \constfunc{bool}{IsOk}{\void} | |
698 | ||
0894707e | 699 | Returns {\tt true} if the filename is valid, {\tt false} if it is not |
ade35f11 VZ |
700 | initialized yet. The assignment functions and |
701 | \helpref{Clear}{wxfilenameclear} may reset the object to the uninitialized, | |
702 | invalid state (the former only do it on failure). | |
2569938d | 703 | |
5bb9aeb2 | 704 | |
2569938d VZ |
705 | \membersection{wxFileName::IsPathSeparator}\label{wxfilenameispathseparator} |
706 | ||
f363e05c | 707 | \func{static bool}{IsPathSeparator}{\param{wxChar }{ch}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} |
2569938d | 708 | |
0894707e | 709 | Returns {\tt true} if the char is a path separator for this format. |
2569938d | 710 | |
5bb9aeb2 | 711 | |
2569938d VZ |
712 | \membersection{wxFileName::IsRelative}\label{wxfilenameisrelative} |
713 | ||
714 | \func{bool}{IsRelative}{\param{wxPathFormat }{format = wxPATH\_NATIVE}} | |
715 | ||
0894707e | 716 | Returns {\tt true} if this filename is not absolute. |
2569938d | 717 | |
5bb9aeb2 | 718 | |
2db991f4 | 719 | \membersection{wxFileName::IsDir}\label{wxfilenameisdir} |
2569938d | 720 | |
2db991f4 | 721 | \constfunc{bool}{IsDir}{\void} |
2569938d | 722 | |
0894707e | 723 | Returns {\tt true} if this object represents a directory, {\tt false} otherwise |
2db991f4 VZ |
724 | (i.e. if it is a file). Note that this method doesn't test whether the |
725 | directory or file really exists, you should use | |
726 | \helpref{DirExists}{wxfilenamedirexists} or | |
727 | \helpref{FileExists}{wxfilenamefileexists} for this. | |
2569938d | 728 | |
5ab2950d JS |
729 | \membersection{wxFileName::MacFindDefaultTypeAndCreator}\label{wxfilenamemacfinddefaulttypeandcreator} |
730 | ||
731 | \func{static bool}{MacFindDefaultTypeAndCreator}{\param{const wxString\& }{ext}, \param{wxUint32* }{type}, \param{wxUint32* }{creator}} | |
732 | ||
733 | On Mac OS, gets the common type and creator for the given extension. | |
734 | ||
735 | \membersection{wxFileName::MacRegisterDefaultTypeAndCreator}\label{wxfilenamemacregisterdefaulttypeandcreator} | |
736 | ||
737 | \func{static void}{MacRegisterDefaultTypeAndCreator}{\param{const wxString\& }{ext}, \param{wxUint32 }{type}, \param{wxUint32 }{creator}} | |
738 | ||
739 | On Mac OS, registers application defined extensions and their default type and creator. | |
740 | ||
741 | \membersection{wxFileName::MacSetDefaultTypeAndCreator}\label{wxfilenamemacsetdefaulttypeandcreator} | |
742 | ||
743 | \func{bool}{MacSetDefaultTypeAndCreator}{\void} | |
744 | ||
745 | On Mac OS, looks up the appropriate type and creator from the registration and then sets it. | |
5bb9aeb2 | 746 | |
0894707e VS |
747 | \membersection{wxFileName::MakeAbsolute}\label{wxfilenamemakeabsolute} |
748 | ||
749 | \func{bool}{MakeAbsolute}{\param{const wxString\& }{cwd = wxEmptyString}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} | |
750 | ||
751 | Make the file name absolute. This is a shortcut for | |
752 | {\tt \helpref{Normalize}{wxfilenamenormalize}(wxPATH\_NORM\_DOTS | wxPATH\_NORM\_ABSOLUTE | wxPATH\_NORM\_TILDE, cwd, format)}. | |
753 | ||
754 | \wxheading{See also} | |
755 | ||
756 | \helpref{MakeRelativeTo}{wxfilenamemakerelativeto}, | |
757 | \helpref{Normalize}{wxfilenamenormalize}, | |
758 | \helpref{IsAbsolute}{wxfilenameisabsolute} | |
759 | ||
5bb9aeb2 | 760 | |
f7d886af VZ |
761 | \membersection{wxFileName::MakeRelativeTo}\label{wxfilenamemakerelativeto} |
762 | ||
f363e05c | 763 | \func{bool}{MakeRelativeTo}{\param{const wxString\& }{pathBase = wxEmptyString}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} |
f7d886af VZ |
764 | |
765 | This function tries to put this file name in a form relative to {\it pathBase}. | |
766 | In other words, it returns the file name which should be used to access this | |
767 | file if the current directory were {\it pathBase}. | |
768 | ||
769 | \docparam{pathBase}{the directory to use as root, current directory is used by | |
770 | default} | |
771 | ||
772 | \docparam{format}{the file name format, native by default} | |
773 | ||
774 | \wxheading{Return value} | |
775 | ||
0894707e | 776 | {\tt true} if the file name has been changed, {\tt false} if we failed to do |
f7d886af VZ |
777 | anything with it (currently this only happens if the file name is on a volume |
778 | different from the volume specified by {\it pathBase}). | |
779 | ||
780 | \wxheading{See also} | |
781 | ||
782 | \helpref{Normalize}{wxfilenamenormalize} | |
2569938d | 783 | |
5bb9aeb2 | 784 | |
2569938d VZ |
785 | \membersection{wxFileName::Mkdir}\label{wxfilenamemkdir} |
786 | ||
1527281e | 787 | \func{bool}{Mkdir}{\param{int }{perm = 0777}, \param{int }{flags = $0$}} |
2569938d | 788 | |
1527281e | 789 | \func{static bool}{Mkdir}{\param{const wxString\& }{dir}, \param{int }{perm = 0777}, \param{int }{flags = $0$}} |
2569938d | 790 | |
6f91bc33 | 791 | \docparam{dir}{the directory to create} |
2569938d | 792 | |
6f91bc33 VZ |
793 | \docparam{parm}{the permissions for the newly created directory} |
794 | ||
1527281e VZ |
795 | \docparam{flags}{if the flags contain {\tt wxPATH\_MKDIR\_FULL} flag, |
796 | try to create each directory in the path and also don't return an error | |
797 | if the target directory already exists.} | |
2569938d | 798 | |
6f91bc33 | 799 | \wxheading{Return value} |
2569938d | 800 | |
0894707e | 801 | Returns {\tt true} if the directory was successfully created, {\tt false} |
6f91bc33 | 802 | otherwise. |
2569938d | 803 | |
5bb9aeb2 | 804 | |
2569938d VZ |
805 | \membersection{wxFileName::Normalize}\label{wxfilenamenormalize} |
806 | ||
32a0d013 | 807 | \func{bool}{Normalize}{\param{int }{flags = wxPATH\_NORM\_ALL}, \param{const wxString\& }{cwd = wxEmptyString}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} |
2569938d | 808 | |
0894707e | 809 | Normalize the path. With the default flags value, the path will be |
2569938d | 810 | made absolute, without any ".." and "." and all environment |
0894707e VS |
811 | variables will be expanded in it. |
812 | ||
813 | \docparam{flags}{The kind of normalization to do with the file name. It can be | |
814 | any or-combination of the following constants: | |
d2c2afc9 | 815 | |
0894707e VS |
816 | \begin{twocollist} |
817 | \twocolitem{{\bf wxPATH\_NORM\_ENV\_VARS}}{replace env vars with their values} | |
bf7f7793 | 818 | \twocolitem{{\bf wxPATH\_NORM\_DOTS}}{squeeze all .. and . when possible; if there are too many .. and thus they cannot be all removed, \false will be returned} |
08890e27 | 819 | \twocolitem{{\bf wxPATH\_NORM\_CASE}}{if filesystem is case insensitive, transform to lower case} |
bf7f7793 | 820 | \twocolitem{{\bf wxPATH\_NORM\_ABSOLUTE}}{make the path absolute prepending \arg{cwd}} |
0894707e | 821 | \twocolitem{{\bf wxPATH\_NORM\_LONG}}{make the path the long form} |
21f60945 | 822 | \twocolitem{{\bf wxPATH\_NORM\_SHORTCUT}}{resolve if it is a shortcut (Windows only)} |
bf7f7793 | 823 | \twocolitem{{\bf wxPATH\_NORM\_TILDE}}{replace ~ and ~user (Unix only)} |
ef92f440 | 824 | \twocolitem{{\bf wxPATH\_NORM\_ALL}}{all of previous flags except \texttt{wxPATH\_NORM\_CASE}} |
0894707e | 825 | \end{twocollist} |
d2c2afc9 | 826 | }% |
0894707e VS |
827 | |
828 | \docparam{cwd}{If not empty, this directory will be used instead of current | |
bf7f7793 | 829 | working directory in normalization (see wxPATH\_NORM\_ABSOLUTE).} |
0894707e | 830 | |
bf7f7793 RR |
831 | \docparam{format}{The file name format to use when processing the paths, native by default.} |
832 | ||
833 | ||
834 | \wxheading{Return value} | |
835 | ||
836 | \true if normalization was successfully or \false otherwise. | |
2569938d | 837 | |
5bb9aeb2 | 838 | |
2569938d VZ |
839 | \membersection{wxFileName::PrependDir}\label{wxfilenameprependdir} |
840 | ||
841 | \func{void}{PrependDir}{\param{const wxString\& }{dir}} | |
842 | ||
5bb9aeb2 VZ |
843 | Prepends a directory to the file path. Please see |
844 | \helpref{AppendDir}{wxfilenameappenddir} for important notes. | |
845 | ||
846 | ||
2569938d VZ |
847 | |
848 | \membersection{wxFileName::RemoveDir}\label{wxfilenameremovedir} | |
849 | ||
2458d90b | 850 | \func{void}{RemoveDir}{\param{size\_t }{pos}} |
2569938d | 851 | |
2458d90b VZ |
852 | Removes the specified directory component from the path. |
853 | ||
854 | \wxheading{See also} | |
855 | ||
856 | \helpref{GetDirCount}{wxfilenamegetdircount} | |
857 | ||
858 | ||
859 | \membersection{wxFileName::RemoveLastDir}\label{wxfilenameremovelastdir} | |
860 | ||
861 | \func{void}{RemoveLastDir}{\void} | |
862 | ||
863 | Removes last directory component from the path. | |
2569938d | 864 | |
5bb9aeb2 | 865 | |
2569938d VZ |
866 | \membersection{wxFileName::Rmdir}\label{wxfilenamermdir} |
867 | ||
868 | \func{bool}{Rmdir}{\void} | |
869 | ||
6f91bc33 | 870 | \func{static bool}{Rmdir}{\param{const wxString\& }{dir}} |
2569938d | 871 | |
95c00185 | 872 | Deletes the specified directory from the file system. |
2569938d | 873 | |
5bb9aeb2 | 874 | |
2569938d VZ |
875 | \membersection{wxFileName::SameAs}\label{wxfilenamesameas} |
876 | ||
2b5f62a0 | 877 | \constfunc{bool}{SameAs}{\param{const wxFileName\& }{filepath}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} |
2569938d | 878 | |
95c00185 | 879 | Compares the filename using the rules of this platform. |
2569938d | 880 | |
5bb9aeb2 | 881 | |
2569938d VZ |
882 | \membersection{wxFileName::SetCwd}\label{wxfilenamesetcwd} |
883 | ||
884 | \func{bool}{SetCwd}{\void} | |
885 | ||
6f91bc33 | 886 | \func{static bool}{SetCwd}{\param{const wxString\& }{cwd}} |
2569938d | 887 | |
95c00185 | 888 | Changes the current working directory. |
2569938d | 889 | |
5bb9aeb2 | 890 | |
2569938d VZ |
891 | \membersection{wxFileName::SetExt}\label{wxfilenamesetext} |
892 | ||
893 | \func{void}{SetExt}{\param{const wxString\& }{ext}} | |
894 | ||
0b40f3d8 RR |
895 | Sets the extension of the file name. Setting an empty string |
896 | as the extension will remove the extension resulting in a file | |
897 | name without a trailing dot, unlike a call to | |
898 | \helpref{SetEmptyExt}{wxfilenamesetemptyext}. | |
899 | ||
900 | \wxheading{See also} | |
901 | ||
902 | \helpref{SetEmptyExt}{wxfilenamesetemptyext} | |
903 | \helpref{ClearExt}{wxfilenameclearext} | |
904 | ||
905 | \membersection{wxFileName::SetEmptyExt}\label{wxfilenamesetemptyext} | |
906 | ||
907 | \func{void}{SetEmptyExt}{\void} | |
908 | ||
909 | Sets the extension of the file name to be an empty extension. | |
910 | This is different from having no extension at all as the file | |
911 | name will have a trailing dot after a call to this method. | |
912 | ||
913 | \wxheading{See also} | |
2569938d | 914 | |
0b40f3d8 RR |
915 | \helpref{SetExt}{wxfilenamesetext} |
916 | \helpref{ClearExt}{wxfilenameclearext} | |
5bb9aeb2 | 917 | |
2569938d VZ |
918 | \membersection{wxFileName::SetFullName}\label{wxfilenamesetfullname} |
919 | ||
920 | \func{void}{SetFullName}{\param{const wxString\& }{fullname}} | |
921 | ||
95c00185 | 922 | The full name is the file name and extension (but without the path). |
2569938d | 923 | |
5bb9aeb2 | 924 | |
2569938d VZ |
925 | \membersection{wxFileName::SetName}\label{wxfilenamesetname} |
926 | ||
927 | \func{void}{SetName}{\param{const wxString\& }{name}} | |
928 | ||
4e43c815 VZ |
929 | Sets the name part (without extension). |
930 | ||
931 | \wxheading{See also} | |
932 | ||
933 | \helpref{SetFullName}{wxfilenamesetfullname} | |
2569938d | 934 | |
5bb9aeb2 | 935 | |
2569938d VZ |
936 | \membersection{wxFileName::SetTimes}\label{wxfilenamesettimes} |
937 | ||
6dbb903b | 938 | \func{bool}{SetTimes}{\param{const wxDateTime* }{dtAccess}, \param{const wxDateTime* }{dtMod}, \param{const wxDateTime* }{dtCreate}} |
2569938d | 939 | |
95c00185 | 940 | Sets the file creation and last access/modification times (any of the pointers may be NULL). |
2569938d | 941 | |
5bb9aeb2 | 942 | |
2569938d VZ |
943 | \membersection{wxFileName::SetVolume}\label{wxfilenamesetvolume} |
944 | ||
945 | \func{void}{SetVolume}{\param{const wxString\& }{volume}} | |
946 | ||
95c00185 | 947 | Sets the volume specifier. |
2569938d | 948 | |
5bb9aeb2 | 949 | |
2569938d VZ |
950 | \membersection{wxFileName::SplitPath}\label{wxfilenamesplitpath} |
951 | ||
dfecbee5 VZ |
952 | \func{static void}{SplitPath}{\param{const wxString\& }{fullpath}, \param{wxString* }{volume}, \param{wxString* }{path}, \param{wxString* }{name}, \param{wxString* }{ext}, \param{bool }{*hasExt = \texttt{NULL}}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} |
953 | ||
2bd25c5a | 954 | \func{static void}{SplitPath}{\param{const wxString\& }{fullpath}, \param{wxString* }{volume}, \param{wxString* }{path}, \param{wxString* }{name}, \param{wxString* }{ext}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} |
2569938d | 955 | |
2bd25c5a | 956 | \func{static void}{SplitPath}{\param{const wxString\& }{fullpath}, \param{wxString* }{path}, \param{wxString* }{name}, \param{wxString* }{ext}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} |
2569938d | 957 | |
2bd25c5a VZ |
958 | This function splits a full file name into components: the volume (with the |
959 | first version) path (including the volume in the second version), the base name | |
960 | and the extension. Any of the output parameters ({\it volume}, {\it path}, | |
961 | {\it name} or {\it ext}) may be {\tt NULL} if you are not interested in the | |
962 | value of a particular component. Also, {\it fullpath} may be empty on entry. | |
963 | ||
964 | On return, {\it path} contains the file path (without the trailing separator), | |
965 | {\it name} contains the file name and {\it ext} contains the file extension | |
966 | without leading dot. All three of them may be empty if the corresponding | |
967 | component is. The old contents of the strings pointed to by these parameters | |
968 | will be overwritten in any case (if the pointers are not {\tt NULL}). | |
2569938d | 969 | |
dfecbee5 VZ |
970 | Note that for a filename ``foo.'' the extension is present, as indicated by the |
971 | trailing dot, but empty. If you need to cope with such cases, you should use | |
972 | \arg{hasExt} instead of relying on testing whether \arg{ext} is empty or not. | |
973 | ||
5bb9aeb2 | 974 | |
f1e77933 VZ |
975 | \membersection{wxFileName::SplitVolume}\label{wxfilenamesplitvolume} |
976 | ||
977 | \func{static void}{SplitVolume}{\param{const wxString\& }{fullpath}, \param{wxString* }{volume}, \param{wxString* }{path}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} | |
978 | ||
979 | Splits the given \arg{fullpath} into the volume part (which may be empty) and | |
980 | the pure path part, not containing any volume. | |
981 | ||
982 | \wxheading{See also} | |
983 | ||
984 | \helpref{SplitPath}{wxfilenamesplitpath} | |
985 | ||
986 | ||
2569938d VZ |
987 | \membersection{wxFileName::Touch}\label{wxfilenametouch} |
988 | ||
989 | \func{bool}{Touch}{\void} | |
990 | ||
95c00185 | 991 | Sets the access and modification times to the current moment. |
2569938d | 992 | |
5bb9aeb2 | 993 | |
2569938d VZ |
994 | \membersection{wxFileName::operator=}\label{wxfilenameoperatorassign} |
995 | ||
996 | \func{wxFileName\& operator}{operator=}{\param{const wxFileName\& }{filename}} | |
997 | ||
2569938d VZ |
998 | \func{wxFileName\& operator}{operator=}{\param{const wxString\& }{filename}} |
999 | ||
6f91bc33 | 1000 | Assigns the new value to this filename object. |
2569938d | 1001 | |
5bb9aeb2 | 1002 | |
2569938d VZ |
1003 | \membersection{wxFileName::operator==}\label{wxfilenameoperatorequal} |
1004 | ||
2b5f62a0 | 1005 | \constfunc{bool operator}{operator==}{\param{const wxFileName\& }{filename}} |
2569938d | 1006 | |
2b5f62a0 | 1007 | \constfunc{bool operator}{operator==}{\param{const wxString\& }{filename}} |
2569938d | 1008 | |
0894707e | 1009 | Returns {\tt true} if the filenames are equal. The string {\it filenames} is |
2b5f62a0 VZ |
1010 | interpreted as a path in the native filename format. |
1011 | ||
5bb9aeb2 | 1012 | |
2b5f62a0 VZ |
1013 | \membersection{wxFileName::operator!=}\label{wxfilenameoperatornotequal} |
1014 | ||
1015 | \constfunc{bool operator}{operator!=}{\param{const wxFileName\& }{filename}} | |
1016 | ||
1017 | \constfunc{bool operator}{operator!=}{\param{const wxString\& }{filename}} | |
1018 | ||
0894707e | 1019 | Returns {\tt true} if the filenames are different. The string {\it filenames} |
2b5f62a0 | 1020 | is interpreted as a path in the native filename format. |
6f91bc33 | 1021 |