]>
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 | |
9 | %% License: wxWindows license | |
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 | |
17 | functions (and \helpref{wxWindows functions}{filefunctions} wrapping them). | |
18 | Second, it includes the functions for working with the files itself. Note that | |
19 | to change the file data you should use \helpref{wxFile}{wxfile} class instead, | |
20 | wxFileName provides functions for working with the file attributes. | |
21 | ||
22 | \wxheading{Derived from} | |
23 | ||
24 | No base class | |
25 | ||
26 | \wxheading{Data structures} | |
27 | ||
28 | Many wxFileName methods accept the path format argument which is by\rtfsp | |
29 | {\tt wxPATH\_NATIVE} by default meaning to use the path format native for the | |
30 | current platform. | |
31 | ||
32 | The path format affects the operation of wxFileName functions in several ways: | |
33 | first and foremost, it defines the path separator character to use, but it also | |
34 | affects other things such as whether the path has the drive part or not. | |
35 | ||
36 | \begin{verbatim} | |
37 | enum wxPathFormat | |
38 | { | |
39 | wxPATH_NATIVE = 0, // the path format for the current platform | |
40 | wxPATH_UNIX, | |
41 | wxPATH_MAC, | |
42 | wxPATH_DOS, | |
43 | wxPATH_VMS, | |
44 | ||
45 | wxPATH_BEOS = wxPATH_UNIX, | |
46 | wxPATH_WIN = wxPATH_DOS, | |
47 | wxPATH_OS2 = wxPATH_DOS | |
48 | } | |
49 | \end{verbatim} | |
50 | ||
51 | The kind of normalization to do with the file name: these values can be | |
52 | or'd together to perform several operations at once in\rtfsp | |
53 | \helpref{Normalize}{wxfilenamenormalize}. | |
54 | ||
55 | \begin{verbatim} | |
56 | enum wxPathNormalize | |
57 | { | |
58 | wxPATH_NORM_ENV_VARS = 0x0001, // replace env vars with their values | |
59 | wxPATH_NORM_DOTS = 0x0002, // squeeze all .. and . and prepend cwd | |
60 | wxPATH_NORM_TILDE = 0x0004, // Unix only: replace ~ and ~user | |
61 | wxPATH_NORM_CASE = 0x0008, // if case insensitive => tolower | |
62 | wxPATH_NORM_ABSOLUTE = 0x0010, // make the path absolute | |
63 | wxPATH_NORM_LONG = 0x0020, // make the path the long form | |
64 | wxPATH_NORM_ALL = 0x003f | |
65 | } | |
66 | \end{verbatim} | |
67 | ||
6f91bc33 VZ |
68 | \latexignore{\rtfignore{\wxheading{Function groups}}} |
69 | ||
70 | \membersection{File name format} | |
71 | ||
72 | wxFileName currently supports the file names in the Unix, DOS/Windows, Mac OS | |
73 | and VMS formats. Although these formats are quite different, wxFileName tries | |
74 | to treat them all in the sam generic way. It supposes that all file names | |
75 | consist of the following parts: the volume (also known as drive under Windows | |
76 | or device under VMS), the path which is a sequence of directory names separated | |
77 | by the \helpref{path separators}{wxfilenamegetpathseparators} and the full | |
78 | filename itself which, in turn, is composed from the base file name and the | |
79 | extension. All of the individual components of the file name may be empty and, | |
80 | for example, the volume name is always empty under Unix, but if they are all | |
81 | empty simultaneously, the filename object is considered to be in an invalid | |
82 | state and \helpref{IsOk}{wxfilenameisok} returns {\tt FALSE} for it. | |
83 | ||
84 | File names can be case-sensitive or not, the function\rtfsp | |
85 | \helpref{IsCaseSensitive}{wxfilenameiscasesensitive} allows to determine this. | |
86 | ||
87 | The rules for determining if the file name is absolute or relative also depends | |
88 | on the file name format and the only portable way to answer to this question is | |
89 | to use \helpref{IsAbsolute}{wxfilenameisabsolute} method. To ensure that the | |
f7d886af VZ |
90 | filename is absolute you may use \helpref{Normalize}{wxfilenamenormalize}. There |
91 | is also an inverse function \helpref{MakeRelativeTo}{wxfilenamemakerelativeto} | |
92 | which undoes what \helpref{Normalize(wxPATH\_NORM\_DOTS}{wxfilenamenormalize} | |
93 | does. | |
6f91bc33 VZ |
94 | |
95 | Other functions returning information about the file format provided by this | |
96 | class are \helpref{GetVolumeSeparator}{wxfilenamegetvolumeseparator},\rtfsp | |
2db991f4 | 97 | \helpref{IsPathSeparator}{wxfilenameispathseparator}. |
6f91bc33 VZ |
98 | |
99 | \helpref{IsRelative}{wxfilenameisrelative} | |
100 | ||
101 | \membersection{File name construction} | |
102 | ||
103 | TODO. | |
104 | ||
105 | \membersection{File tests} | |
106 | ||
107 | Before doing the other tests you should use \helpref{IsOk}{wxfilenameisok} to | |
108 | verify that the filename is well defined. If it is, | |
109 | \helpref{FileExists}{wxfilenamefileexists} can be used to test if a file with | |
110 | such name exists and \helpref{DirExists}{wxfilenamedirexists} - if a directory | |
111 | with this name exists. | |
112 | ||
113 | File names should be compared using \helpref{SameAs}{wxfilenamesameas} method | |
114 | or \helpref{$==$}{wxfilenameoperatorequal}. | |
115 | ||
116 | \membersection{File name components} | |
117 | ||
118 | These functions allow to examine and modify the directories of the path: | |
119 | ||
120 | \helpref{AppendDir}{wxfilenameappenddir}\\ | |
121 | \helpref{InsertDir}{wxfilenameinsertdir}\\ | |
122 | \helpref{GetDirCount}{wxfilenamegetdircount} | |
123 | \helpref{PrependDir}{wxfilenameprependdir}\\ | |
124 | \helpref{RemoveDir}{wxfilenameremovedir} | |
125 | ||
126 | To change the components of the file name individually you can use the | |
127 | following functions: | |
128 | ||
129 | \helpref{GetExt}{wxfilenamegetext}\\ | |
130 | \helpref{GetName}{wxfilenamegetname}\\ | |
131 | \helpref{GetVolume}{wxfilenamegetvolume}\\ | |
132 | \helpref{HasExt}{wxfilenamehasext}\\ | |
133 | \helpref{HasName}{wxfilenamehasname}\\ | |
134 | \helpref{HasVolume}{wxfilenamehasvolume}\\ | |
135 | \helpref{SetExt}{wxfilenamesetext}\\ | |
136 | \helpref{SetName}{wxfilenamesetname}\\ | |
137 | \helpref{SetVolume}{wxfilenamesetvolume}\\ | |
138 | ||
139 | \membersection{Operations} | |
140 | ||
141 | These methods allow to work with the file creation, access and modification | |
6dbb903b VZ |
142 | times. Note that not all filesystems under all platforms implement these times |
143 | in the same way. For example, the access time under Windows has a resolution of | |
144 | one day (so it is really the access date and not time). The access time may be | |
145 | updated when the file is executed or not depending on the platform. | |
6f91bc33 VZ |
146 | |
147 | \helpref{GetModificationTime}{wxfilenamegetmodificationtime}\\ | |
148 | \helpref{GetTimes}{wxfilenamegettimes}\\ | |
149 | \helpref{SetTimes}{wxfilenamesettimes}\\ | |
150 | \helpref{Touch}{wxfilenametouch} | |
151 | ||
152 | Other file system operations functions are: | |
153 | ||
154 | \helpref{Mkdir}{wxfilenamemkdir}\\ | |
155 | \helpref{Rmdir}{wxfilenamermdir} | |
156 | ||
2569938d VZ |
157 | \latexignore{\rtfignore{\wxheading{Members}}} |
158 | ||
6f91bc33 | 159 | \membersection{wxFileName::wxFileName}\label{wxfilenamewxfilename} |
2569938d VZ |
160 | |
161 | \func{}{wxFileName}{\void} | |
162 | ||
163 | Default constructor. | |
164 | ||
2569938d VZ |
165 | \func{}{wxFileName}{\param{const wxFileName\& }{filename}} |
166 | ||
167 | Copy constructor. | |
168 | ||
2569938d VZ |
169 | \func{}{wxFileName}{\param{const wxString\& }{fullpath}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} |
170 | ||
6f91bc33 | 171 | From a full filename: if it terminates with a '/', a directory path |
2569938d VZ |
172 | is contructed (the name will be empty), otherwise a file name and |
173 | extension are extracted from it | |
174 | ||
2569938d VZ |
175 | \func{}{wxFileName}{\param{const wxString\& }{path}, \param{const wxString\& }{name}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} |
176 | ||
6f91bc33 | 177 | Constructor from a directory name and a file name. |
2569938d VZ |
178 | |
179 | \func{}{wxFileName}{\param{const wxString\& }{path}, \param{const wxString\& }{name}, \param{const wxString\& }{ext}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} | |
180 | ||
81f25632 VZ |
181 | Constructor from a directory name, base file name and extension |
182 | ||
183 | \func{}{wxFileName}{\param{const wxString\& }{volume}, \param{const wxString\& }{path}, \param{const wxString\& }{name}, \param{const wxString\& }{ext}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} | |
184 | ||
185 | Constructor from a volume name, a directory name, base file name and extension | |
2569938d VZ |
186 | |
187 | \membersection{wxFileName::AppendDir}\label{wxfilenameappenddir} | |
188 | ||
189 | \func{void}{AppendDir}{\param{const wxString\& }{dir}} | |
190 | ||
191 | ||
192 | \membersection{wxFileName::Assign}\label{wxfilenameassign} | |
193 | ||
194 | \func{void}{Assign}{\param{const wxFileName\& }{filepath}} | |
195 | ||
2569938d VZ |
196 | \func{void}{Assign}{\param{const wxString\& }{fullpath}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} |
197 | ||
2569938d VZ |
198 | \func{void}{Assign}{\param{const wxString\& }{volume}, \param{const wxString\& }{path}, \param{const wxString\& }{name}, \param{const wxString\& }{ext}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} |
199 | ||
2569938d VZ |
200 | \func{void}{Assign}{\param{const wxString\& }{path}, \param{const wxString\& }{name}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} |
201 | ||
2569938d VZ |
202 | \func{void}{Assign}{\param{const wxString\& }{path}, \param{const wxString\& }{name}, \param{const wxString\& }{ext}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} |
203 | ||
204 | ||
205 | \membersection{wxFileName::AssignCwd}\label{wxfilenameassigncwd} | |
206 | ||
6f91bc33 VZ |
207 | \func{void}{AssignCwd}{\param{const wxString\& }{volume = ""}} |
208 | ||
209 | Makes this object refer to the current working directory on the specified | |
210 | volume (or current volume if {\it volume} is empty). | |
2569938d | 211 | |
6f91bc33 | 212 | \wxheading{See also} |
2569938d | 213 | |
6f91bc33 | 214 | \helpref{GetCwd}{wxfilenamegetcwd} |
2569938d VZ |
215 | |
216 | \membersection{wxFileName::AssignDir}\label{wxfilenameassigndir} | |
217 | ||
218 | \func{void}{AssignDir}{\param{const wxString\& }{dir}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} | |
219 | ||
81f25632 VZ |
220 | Set this file name object to the given directory name. The name and extension |
221 | will be empty. | |
2569938d VZ |
222 | |
223 | \membersection{wxFileName::AssignHomeDir}\label{wxfilenameassignhomedir} | |
224 | ||
225 | \func{void}{AssignHomeDir}{\void} | |
226 | ||
81f25632 | 227 | Set this file name object to the home directory. |
2569938d VZ |
228 | |
229 | \membersection{wxFileName::AssignTempFileName}\label{wxfilenameassigntempfilename} | |
230 | ||
df22f860 | 231 | \func{void}{AssignTempFileName}{\param{const wxString\& }{prefix}, \param{wxFile *}{fileTemp = {\tt NULL}}} |
2569938d | 232 | |
ade35f11 VZ |
233 | The function calls \helpref{CreateTempFileName}{wxfilenamecreatetempfilename} to |
234 | create a temporary file and sets this object to the name of the file. If a | |
235 | temporary file couldn't be created, the object is put into the\rtfsp | |
236 | \helpref{invalid}{wxfilenameisok} state. | |
2569938d VZ |
237 | |
238 | \membersection{wxFileName::Clear}\label{wxfilenameclear} | |
239 | ||
240 | \func{void}{Clear}{\void} | |
241 | ||
ade35f11 VZ |
242 | Reset all components to default, uninitialized state. |
243 | ||
02a3b391 | 244 | \membersection{wxFileName::CreateTempFileName}\label{wxfilenamecreatetempfilename} |
ade35f11 | 245 | |
df22f860 | 246 | \func{static wxString}{CreateTempFileName}{\param{const wxString\& }{prefix}, \param{wxFile *}{fileTemp = {\tt NULL}}} |
ade35f11 VZ |
247 | |
248 | Returns a temporary file name starting with the given {\it prefix}. If | |
249 | the {\it prefix} is an absolute path, the temporary file is created in this | |
250 | directory, otherwise it is created in the default system directory for the | |
251 | temporary files or in the current directory. | |
2569938d | 252 | |
df22f860 VZ |
253 | If the function succeeds, the temporary file is actually created. If\rtfsp |
254 | {\it fileTemp} is not {\tt NULL}, this file will be opened using the name of | |
255 | the temporary file. When possible, this is done in an atomic way ensuring that | |
256 | no race condition occurs between the temporary file name generation and opening | |
257 | it which could often lead to security compromise on the multiuser systems. | |
258 | If {\it fileTemp} is {\tt NULL}, the file is only created, but not opened. | |
259 | ||
260 | Under Unix, the temporary file will have read and write permissions for the | |
261 | owner only to minimize the security problems. | |
262 | ||
263 | \wxheading{Parameters} | |
264 | ||
265 | \docparam{prefix}{Prefix to use for the temporary file name construction} | |
266 | ||
267 | \docparam{fileTemp}{The file to open or {\tt NULL} to just get the name} | |
ade35f11 VZ |
268 | |
269 | \wxheading{Return value} | |
270 | ||
271 | The full temporary file name or an empty string on error. | |
2569938d VZ |
272 | |
273 | \membersection{wxFileName::DirExists}\label{wxfilenamedirexists} | |
274 | ||
275 | \func{bool}{DirExists}{\void} | |
276 | ||
2569938d VZ |
277 | \func{bool}{DirExists}{\param{const wxString\& }{dir}} |
278 | ||
02a3b391 | 279 | Does the directory with this name exists? |
2569938d VZ |
280 | |
281 | \membersection{wxFileName::DirName}\label{wxfilenamedirname} | |
282 | ||
283 | \func{wxFileName}{DirName}{\param{const wxString\& }{dir}} | |
284 | ||
2569938d VZ |
285 | \membersection{wxFileName::FileExists}\label{wxfilenamefileexists} |
286 | ||
287 | \func{bool}{FileExists}{\void} | |
288 | ||
2569938d VZ |
289 | \func{bool}{FileExists}{\param{const wxString\& }{file}} |
290 | ||
02a3b391 | 291 | Does the file with this name exists? |
2569938d VZ |
292 | |
293 | \membersection{wxFileName::FileName}\label{wxfilenamefilename} | |
294 | ||
295 | \func{wxFileName}{FileName}{\param{const wxString\& }{file}} | |
296 | ||
297 | static pseudo constructors | |
298 | ||
2569938d VZ |
299 | \membersection{wxFileName::GetCwd}\label{wxfilenamegetcwd} |
300 | ||
6f91bc33 VZ |
301 | \func{wxString}{GetCwd}{\param{const wxString\& }{volume = ""}} |
302 | ||
303 | Retrieve the value of the current working directory on the specified volume. If | |
304 | the volume is empty, the programs current working directory is returned for the | |
305 | current volume. | |
306 | ||
307 | \wxheading{Return value} | |
308 | ||
309 | The string containing the current working directory or an empty string on | |
310 | error. | |
2569938d | 311 | |
6f91bc33 VZ |
312 | \wxheading{See also} |
313 | ||
314 | \helpref{AssignCwd}{wxfilenameassigncwd} | |
2569938d VZ |
315 | |
316 | \membersection{wxFileName::GetDirCount}\label{wxfilenamegetdircount} | |
317 | ||
318 | \constfunc{size\_t}{GetDirCount}{\void} | |
319 | ||
320 | ||
321 | \membersection{wxFileName::GetDirs}\label{wxfilenamegetdirs} | |
322 | ||
323 | \constfunc{const wxArrayString\&}{GetDirs}{\void} | |
324 | ||
325 | ||
326 | \membersection{wxFileName::GetExt}\label{wxfilenamegetext} | |
327 | ||
328 | \constfunc{wxString}{GetExt}{\void} | |
329 | ||
330 | ||
331 | \membersection{wxFileName::GetFormat}\label{wxfilenamegetformat} | |
332 | ||
333 | \func{wxPathFormat}{GetFormat}{\param{wxPathFormat }{format = wxPATH\_NATIVE}} | |
334 | ||
335 | various helpers | |
336 | get the canonical path format for this platform | |
337 | ||
338 | ||
339 | \membersection{wxFileName::GetFullName}\label{wxfilenamegetfullname} | |
340 | ||
341 | \constfunc{wxString}{GetFullName}{\void} | |
342 | ||
343 | ||
344 | \membersection{wxFileName::GetFullPath}\label{wxfilenamegetfullpath} | |
345 | ||
346 | \constfunc{wxString}{GetFullPath}{\param{wxPathFormat }{format = wxPATH\_NATIVE}} | |
347 | ||
348 | add separator Construct full path with name and ext | |
349 | ||
350 | ||
351 | \membersection{wxFileName::GetHomeDir}\label{wxfilenamegethomedir} | |
352 | ||
353 | \func{wxString}{GetHomeDir}{\void} | |
354 | ||
355 | ||
356 | \membersection{wxFileName::GetLongPath}\label{wxfilenamegetlongpath} | |
357 | ||
358 | \constfunc{wxString}{GetLongPath}{\void} | |
359 | ||
360 | Return the long form of the path (returns identity on non-Windows platforms) | |
361 | ||
362 | ||
363 | \membersection{wxFileName::GetModificationTime}\label{wxfilenamegetmodificationtime} | |
364 | ||
365 | \constfunc{wxDateTime}{GetModificationTime}{\void} | |
366 | ||
367 | convenience wrapper: get just the last mod time of the file | |
368 | ||
369 | ||
370 | \membersection{wxFileName::GetName}\label{wxfilenamegetname} | |
371 | ||
372 | \constfunc{wxString}{GetName}{\void} | |
373 | ||
374 | ||
375 | \membersection{wxFileName::GetPath}\label{wxfilenamegetpath} | |
376 | ||
377 | \constfunc{wxString}{GetPath}{\param{bool }{add\_separator = FALSE}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} | |
378 | ||
379 | Construct path only - possibly with the trailing separator | |
380 | ||
381 | ||
382 | \membersection{wxFileName::GetPathSeparators}\label{wxfilenamegetpathseparators} | |
383 | ||
384 | \func{wxString}{GetPathSeparators}{\param{wxPathFormat }{format = wxPATH\_NATIVE}} | |
385 | ||
386 | get the string of path separators for this format | |
387 | ||
388 | ||
389 | \membersection{wxFileName::GetPathWithSep}\label{wxfilenamegetpathwithsep} | |
390 | ||
391 | \constfunc{wxString}{GetPathWithSep}{\param{wxPathFormat }{format = wxPATH\_NATIVE}} | |
392 | ||
393 | more readable synonym | |
394 | ||
395 | ||
396 | \membersection{wxFileName::GetShortPath}\label{wxfilenamegetshortpath} | |
397 | ||
398 | \constfunc{wxString}{GetShortPath}{\void} | |
399 | ||
400 | Return the short form of the path (returns identity on non-Windows platforms) | |
401 | ||
402 | ||
403 | \membersection{wxFileName::GetTimes}\label{wxfilenamegettimes} | |
404 | ||
6dbb903b | 405 | \constfunc{bool}{GetTimes}{\param{wxDateTime* }{dtAccess}, \param{wxDateTime* }{dtMod}, \param{wxDateTime* }{dtCreate}} |
2569938d | 406 | |
6dbb903b | 407 | return the last access, last modification and creation times |
2569938d VZ |
408 | (any of the pointers may be NULL) |
409 | ||
410 | ||
411 | \membersection{wxFileName::GetVolume}\label{wxfilenamegetvolume} | |
412 | ||
413 | \constfunc{wxString}{GetVolume}{\void} | |
414 | ||
415 | ||
416 | \membersection{wxFileName::GetVolumeSeparator}\label{wxfilenamegetvolumeseparator} | |
417 | ||
418 | \func{wxString}{GetVolumeSeparator}{\param{wxPathFormat }{format = wxPATH\_NATIVE}} | |
419 | ||
420 | get the string separating the volume from the path for this format | |
421 | ||
422 | ||
423 | \membersection{wxFileName::HasExt}\label{wxfilenamehasext} | |
424 | ||
425 | \constfunc{bool}{HasExt}{\void} | |
426 | ||
427 | ||
428 | \membersection{wxFileName::HasName}\label{wxfilenamehasname} | |
429 | ||
430 | \constfunc{bool}{HasName}{\void} | |
431 | ||
432 | ||
433 | \membersection{wxFileName::HasVolume}\label{wxfilenamehasvolume} | |
434 | ||
435 | \constfunc{bool}{HasVolume}{\void} | |
436 | ||
437 | ||
438 | \membersection{wxFileName::InsertDir}\label{wxfilenameinsertdir} | |
439 | ||
440 | \func{void}{InsertDir}{\param{int }{before}, \param{const wxString\& }{dir}} | |
441 | ||
442 | ||
443 | \membersection{wxFileName::IsAbsolute}\label{wxfilenameisabsolute} | |
444 | ||
445 | \func{bool}{IsAbsolute}{\param{wxPathFormat }{format = wxPATH\_NATIVE}} | |
446 | ||
447 | is this filename absolute? | |
448 | ||
449 | ||
450 | \membersection{wxFileName::IsCaseSensitive}\label{wxfilenameiscasesensitive} | |
451 | ||
452 | \func{bool}{IsCaseSensitive}{\param{wxPathFormat }{format = wxPATH\_NATIVE}} | |
453 | ||
454 | Tests | |
455 | are the file names of this type cases sensitive? | |
456 | ||
457 | ||
458 | \membersection{wxFileName::IsOk}\label{wxfilenameisok} | |
459 | ||
460 | \constfunc{bool}{IsOk}{\void} | |
461 | ||
ade35f11 VZ |
462 | Returns {\tt TRUE} if the filename is valid, {\tt FALSE} if it is not |
463 | initialized yet. The assignment functions and | |
464 | \helpref{Clear}{wxfilenameclear} may reset the object to the uninitialized, | |
465 | invalid state (the former only do it on failure). | |
2569938d VZ |
466 | |
467 | \membersection{wxFileName::IsPathSeparator}\label{wxfilenameispathseparator} | |
468 | ||
469 | \func{bool}{IsPathSeparator}{\param{wxChar }{ch}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} | |
470 | ||
f7d886af | 471 | Returns {\tt TRUE} if the char is a path separator for this format. |
2569938d VZ |
472 | |
473 | \membersection{wxFileName::IsRelative}\label{wxfilenameisrelative} | |
474 | ||
475 | \func{bool}{IsRelative}{\param{wxPathFormat }{format = wxPATH\_NATIVE}} | |
476 | ||
f7d886af | 477 | Returns {\tt TRUE} if this filename is not absolute. |
2569938d | 478 | |
2db991f4 | 479 | \membersection{wxFileName::IsDir}\label{wxfilenameisdir} |
2569938d | 480 | |
2db991f4 | 481 | \constfunc{bool}{IsDir}{\void} |
2569938d | 482 | |
2db991f4 VZ |
483 | Returns {\tt TRUE} if this object represents a directory, {\tt FALSE} otherwise |
484 | (i.e. if it is a file). Note that this method doesn't test whether the | |
485 | directory or file really exists, you should use | |
486 | \helpref{DirExists}{wxfilenamedirexists} or | |
487 | \helpref{FileExists}{wxfilenamefileexists} for this. | |
2569938d | 488 | |
f7d886af VZ |
489 | \membersection{wxFileName::MakeRelativeTo}\label{wxfilenamemakerelativeto} |
490 | ||
491 | \func{bool}{MakeRelativeTo}{\param{const wxString\& }{pathBase = ""}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} | |
492 | ||
493 | This function tries to put this file name in a form relative to {\it pathBase}. | |
494 | In other words, it returns the file name which should be used to access this | |
495 | file if the current directory were {\it pathBase}. | |
496 | ||
497 | \docparam{pathBase}{the directory to use as root, current directory is used by | |
498 | default} | |
499 | ||
500 | \docparam{format}{the file name format, native by default} | |
501 | ||
502 | \wxheading{Return value} | |
503 | ||
504 | {\tt TRUE} if the file name has been changed, {\tt FALSE} if we failed to do | |
505 | anything with it (currently this only happens if the file name is on a volume | |
506 | different from the volume specified by {\it pathBase}). | |
507 | ||
508 | \wxheading{See also} | |
509 | ||
510 | \helpref{Normalize}{wxfilenamenormalize} | |
2569938d VZ |
511 | |
512 | \membersection{wxFileName::Mkdir}\label{wxfilenamemkdir} | |
513 | ||
514 | \func{bool}{Mkdir}{\param{int }{perm = 0777}, \param{bool }{full = FALSE}} | |
515 | ||
6f91bc33 | 516 | \func{static bool}{Mkdir}{\param{const wxString\& }{dir}, \param{int }{perm = 0777}, \param{bool }{full = FALSE}} |
2569938d | 517 | |
6f91bc33 | 518 | \docparam{dir}{the directory to create} |
2569938d | 519 | |
6f91bc33 VZ |
520 | \docparam{parm}{the permissions for the newly created directory} |
521 | ||
522 | \docparam{full}{if {\tt TRUE}, will try to make each directory in the path} | |
2569938d | 523 | |
6f91bc33 | 524 | \wxheading{Return value} |
2569938d | 525 | |
6f91bc33 VZ |
526 | Returns {\tt TRUE} if the directory was successfully created, {\tt FALSE} |
527 | otherwise. | |
2569938d VZ |
528 | |
529 | \membersection{wxFileName::Normalize}\label{wxfilenamenormalize} | |
530 | ||
32a0d013 | 531 | \func{bool}{Normalize}{\param{int }{flags = wxPATH\_NORM\_ALL}, \param{const wxString\& }{cwd = wxEmptyString}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} |
2569938d VZ |
532 | |
533 | operations on the path | |
534 | normalize the path: with the default flags value, the path will be | |
535 | made absolute, without any ".." and "." and all environment | |
536 | variables will be expanded in it | |
537 | this may be done using another (than current) value of cwd | |
538 | ||
539 | ||
540 | \membersection{wxFileName::PrependDir}\label{wxfilenameprependdir} | |
541 | ||
542 | \func{void}{PrependDir}{\param{const wxString\& }{dir}} | |
543 | ||
544 | ||
545 | \membersection{wxFileName::RemoveDir}\label{wxfilenameremovedir} | |
546 | ||
547 | \func{void}{RemoveDir}{\param{int }{pos}} | |
548 | ||
549 | ||
550 | \membersection{wxFileName::Rmdir}\label{wxfilenamermdir} | |
551 | ||
552 | \func{bool}{Rmdir}{\void} | |
553 | ||
6f91bc33 | 554 | \func{static bool}{Rmdir}{\param{const wxString\& }{dir}} |
2569938d | 555 | |
6f91bc33 | 556 | Deletes the specified directory. |
2569938d VZ |
557 | |
558 | ||
559 | \membersection{wxFileName::SameAs}\label{wxfilenamesameas} | |
560 | ||
561 | \func{bool}{SameAs}{\param{const wxFileName\& }{filepath}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} | |
562 | ||
6f91bc33 | 563 | Compares the filename using the rules of this platform |
2569938d VZ |
564 | |
565 | ||
566 | \membersection{wxFileName::SetCwd}\label{wxfilenamesetcwd} | |
567 | ||
568 | \func{bool}{SetCwd}{\void} | |
569 | ||
6f91bc33 | 570 | \func{static bool}{SetCwd}{\param{const wxString\& }{cwd}} |
2569938d | 571 | |
6f91bc33 | 572 | change the current working directory |
2569938d VZ |
573 | |
574 | \membersection{wxFileName::SetExt}\label{wxfilenamesetext} | |
575 | ||
576 | \func{void}{SetExt}{\param{const wxString\& }{ext}} | |
577 | ||
578 | ||
579 | \membersection{wxFileName::SetFullName}\label{wxfilenamesetfullname} | |
580 | ||
581 | \func{void}{SetFullName}{\param{const wxString\& }{fullname}} | |
582 | ||
583 | full name is the file name + extension (but without the path) | |
584 | ||
585 | ||
586 | \membersection{wxFileName::SetName}\label{wxfilenamesetname} | |
587 | ||
588 | \func{void}{SetName}{\param{const wxString\& }{name}} | |
589 | ||
590 | ||
591 | \membersection{wxFileName::SetTimes}\label{wxfilenamesettimes} | |
592 | ||
6dbb903b | 593 | \func{bool}{SetTimes}{\param{const wxDateTime* }{dtAccess}, \param{const wxDateTime* }{dtMod}, \param{const wxDateTime* }{dtCreate}} |
2569938d VZ |
594 | |
595 | set the file creation and last access/mod times | |
596 | (any of the pointers may be NULL) | |
597 | ||
598 | ||
599 | \membersection{wxFileName::SetVolume}\label{wxfilenamesetvolume} | |
600 | ||
601 | \func{void}{SetVolume}{\param{const wxString\& }{volume}} | |
602 | ||
603 | ||
604 | \membersection{wxFileName::SplitPath}\label{wxfilenamesplitpath} | |
605 | ||
606 | \func{void}{SplitPath}{\param{const wxString\& }{fullpath}, \param{wxString* }{volume}, \param{wxString* }{path}, \param{wxString* }{name}, \param{wxString* }{ext}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} | |
607 | ||
608 | \func{void}{SplitPath}{\param{const wxString\& }{fullpath}, \param{wxString* }{path}, \param{wxString* }{name}, \param{wxString* }{ext}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} | |
609 | ||
610 | split a fullpath into the volume, path, (base) name and extension | |
611 | (all of the pointers can be NULL) | |
612 | ||
613 | \membersection{wxFileName::Touch}\label{wxfilenametouch} | |
614 | ||
615 | \func{bool}{Touch}{\void} | |
616 | ||
617 | set the access and modification times to the current moment | |
618 | ||
619 | ||
620 | \membersection{wxFileName::operator=}\label{wxfilenameoperatorassign} | |
621 | ||
622 | \func{wxFileName\& operator}{operator=}{\param{const wxFileName\& }{filename}} | |
623 | ||
2569938d VZ |
624 | \func{wxFileName\& operator}{operator=}{\param{const wxString\& }{filename}} |
625 | ||
6f91bc33 | 626 | Assigns the new value to this filename object. |
2569938d VZ |
627 | |
628 | \membersection{wxFileName::operator==}\label{wxfilenameoperatorequal} | |
629 | ||
630 | \func{bool operator}{operator==}{\param{const wxFileName\& }{filename}} | |
631 | ||
2569938d VZ |
632 | \func{bool operator}{operator==}{\param{const wxString\& }{filename}} |
633 | ||
6f91bc33 VZ |
634 | Returns {\tt TRUE} if the filenames are equal for the native file format. |
635 |