]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/filename.tex
Faster Deselect
[wxWidgets.git] / docs / latex / wx / filename.tex
CommitLineData
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
fc2171bd 9%% License: wxWidgets license
2569938d
VZ
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12\section{\class{wxFileName}}\label{wxfilename}
13
14wxFileName encapsulates a file name. This class serves two purposes: first, it
15provides the functions to split the file names into components and to recombine
16these components in the full file name which can then be passed to the OS file
fc2171bd 17functions (and \helpref{wxWidgets functions}{filefunctions} wrapping them).
2569938d 18Second, it includes the functions for working with the files itself. Note that
95c00185 19to change the file data you should use \helpref{wxFile}{wxfile} class instead.
2569938d
VZ
20wxFileName provides functions for working with the file attributes.
21
22\wxheading{Derived from}
23
24No base class
25
93ab511d
VZ
26\wxheading{Include files}
27
28<wx/filename.h>
29
2569938d
VZ
30\wxheading{Data structures}
31
32Many 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
34current platform.
35
36The path format affects the operation of wxFileName functions in several ways:
37first and foremost, it defines the path separator character to use, but it also
38affects other things such as whether the path has the drive part or not.
39
40\begin{verbatim}
41enum 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
61wxFileName currently supports the file names in the Unix, DOS/Windows, Mac OS
62and VMS formats. Although these formats are quite different, wxFileName tries
2edb0bde 63to treat them all in the same generic way. It supposes that all file names
6f91bc33
VZ
64consist of the following parts: the volume (also known as drive under Windows
65or device under VMS), the path which is a sequence of directory names separated
66by the \helpref{path separators}{wxfilenamegetpathseparators} and the full
67filename itself which, in turn, is composed from the base file name and the
68extension. All of the individual components of the file name may be empty and,
69for example, the volume name is always empty under Unix, but if they are all
70empty simultaneously, the filename object is considered to be in an invalid
0894707e 71state and \helpref{IsOk}{wxfilenameisok} returns {\tt false} for it.
6f91bc33
VZ
72
73File names can be case-sensitive or not, the function\rtfsp
74\helpref{IsCaseSensitive}{wxfilenameiscasesensitive} allows to determine this.
75
76The rules for determining if the file name is absolute or relative also depends
77on the file name format and the only portable way to answer to this question is
78to use \helpref{IsAbsolute}{wxfilenameisabsolute} method. To ensure that the
0894707e 79filename is absolute you may use \helpref{MakeAbsolute}{wxfilenamemakeabsolute}.
d2c2afc9 80There is also an inverse function
0894707e
VS
81\helpref{MakeRelativeTo}{wxfilenamemakerelativeto} which undoes what
82\helpref{Normalize(wxPATH\_NORM\_DOTS)}{wxfilenamenormalize} does.
6f91bc33
VZ
83
84Other functions returning information about the file format provided by this
85class are \helpref{GetVolumeSeparator}{wxfilenamegetvolumeseparator},\rtfsp
2db991f4 86\helpref{IsPathSeparator}{wxfilenameispathseparator}.
6f91bc33
VZ
87
88\helpref{IsRelative}{wxfilenameisrelative}
89
5bb9aeb2 90
f0e8a2d0 91\membersection{File name construction}\label{filenameconstruction}
6f91bc33
VZ
92
93TODO.
94
5bb9aeb2 95
f0e8a2d0 96\membersection{File tests}\label{filetests}
6f91bc33
VZ
97
98Before doing the other tests you should use \helpref{IsOk}{wxfilenameisok} to
99verify that the filename is well defined. If it is,
100\helpref{FileExists}{wxfilenamefileexists} can be used to test if a file with
101such name exists and \helpref{DirExists}{wxfilenamedirexists} - if a directory
102with this name exists.
103
104File names should be compared using \helpref{SameAs}{wxfilenamesameas} method
105or \helpref{$==$}{wxfilenameoperatorequal}.
106
5bb9aeb2 107
f0e8a2d0 108\membersection{File name components}\label{filenamecomponents}
6f91bc33
VZ
109
110These functions allow to examine and modify the directories of the path:
111
112\helpref{AppendDir}{wxfilenameappenddir}\\
113\helpref{InsertDir}{wxfilenameinsertdir}\\
114\helpref{GetDirCount}{wxfilenamegetdircount}
115\helpref{PrependDir}{wxfilenameprependdir}\\
116\helpref{RemoveDir}{wxfilenameremovedir}
117
118To change the components of the file name individually you can use the
119following functions:
120
121\helpref{GetExt}{wxfilenamegetext}\\
122\helpref{GetName}{wxfilenamegetname}\\
123\helpref{GetVolume}{wxfilenamegetvolume}\\
124\helpref{HasExt}{wxfilenamehasext}\\
125\helpref{HasName}{wxfilenamehasname}\\
126\helpref{HasVolume}{wxfilenamehasvolume}\\
127\helpref{SetExt}{wxfilenamesetext}\\
128\helpref{SetName}{wxfilenamesetname}\\
129\helpref{SetVolume}{wxfilenamesetvolume}\\
130
5bb9aeb2 131
f0e8a2d0 132\membersection{Operations}\label{filenameoperations}
6f91bc33
VZ
133
134These methods allow to work with the file creation, access and modification
6dbb903b
VZ
135times. Note that not all filesystems under all platforms implement these times
136in the same way. For example, the access time under Windows has a resolution of
137one day (so it is really the access date and not time). The access time may be
138updated when the file is executed or not depending on the platform.
6f91bc33
VZ
139
140\helpref{GetModificationTime}{wxfilenamegetmodificationtime}\\
141\helpref{GetTimes}{wxfilenamegettimes}\\
142\helpref{SetTimes}{wxfilenamesettimes}\\
143\helpref{Touch}{wxfilenametouch}
144
145Other file system operations functions are:
146
147\helpref{Mkdir}{wxfilenamemkdir}\\
148\helpref{Rmdir}{wxfilenamermdir}
149
2569938d
VZ
150\latexignore{\rtfignore{\wxheading{Members}}}
151
5bb9aeb2 152
6f91bc33 153\membersection{wxFileName::wxFileName}\label{wxfilenamewxfilename}
2569938d
VZ
154
155\func{}{wxFileName}{\void}
156
157Default constructor.
158
2569938d
VZ
159\func{}{wxFileName}{\param{const wxFileName\& }{filename}}
160
161Copy constructor.
162
2569938d
VZ
163\func{}{wxFileName}{\param{const wxString\& }{fullpath}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
164
95c00185 165Constructor taking a full filename. If it terminates with a '/', a directory path
2edb0bde 166is constructed (the name will be empty), otherwise a file name and
95c00185 167extension are extracted from it.
2569938d 168
2569938d
VZ
169\func{}{wxFileName}{\param{const wxString\& }{path}, \param{const wxString\& }{name}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
170
6f91bc33 171Constructor from a directory name and a file name.
2569938d
VZ
172
173\func{}{wxFileName}{\param{const wxString\& }{path}, \param{const wxString\& }{name}, \param{const wxString\& }{ext}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
174
95c00185 175Constructor from a directory name, base file name and extension.
81f25632
VZ
176
177\func{}{wxFileName}{\param{const wxString\& }{volume}, \param{const wxString\& }{path}, \param{const wxString\& }{name}, \param{const wxString\& }{ext}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
178
95c00185 179Constructor from a volume name, a directory name, base file name and extension.
2569938d 180
5bb9aeb2 181
2569938d
VZ
182\membersection{wxFileName::AppendDir}\label{wxfilenameappenddir}
183
184\func{void}{AppendDir}{\param{const wxString\& }{dir}}
185
5bb9aeb2
VZ
186Appends a directory component to the path. This component should contain a
187single directory name level, i.e. not contain any path or volume separators nor
188should it be empty, otherwise the function does nothing (and generates an
189assert failure in debug build).
190
2569938d
VZ
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
95c00185 204Creates the file name from various combinations of data.
2569938d 205
5bb9aeb2 206
2569938d
VZ
207\membersection{wxFileName::AssignCwd}\label{wxfilenameassigncwd}
208
f363e05c 209\func{static void}{AssignCwd}{\param{const wxString\& }{volume = wxEmptyString}}
6f91bc33
VZ
210
211Makes this object refer to the current working directory on the specified
212volume (or current volume if {\it volume} is empty).
2569938d 213
6f91bc33 214\wxheading{See also}
2569938d 215
6f91bc33 216\helpref{GetCwd}{wxfilenamegetcwd}
2569938d 217
5bb9aeb2 218
2569938d
VZ
219\membersection{wxFileName::AssignDir}\label{wxfilenameassigndir}
220
221\func{void}{AssignDir}{\param{const wxString\& }{dir}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
222
95c00185 223Sets this file name object to the given directory name. The name and extension
81f25632 224will be empty.
2569938d 225
5bb9aeb2 226
2569938d
VZ
227\membersection{wxFileName::AssignHomeDir}\label{wxfilenameassignhomedir}
228
229\func{void}{AssignHomeDir}{\void}
230
95c00185 231Sets this file name object to the home directory.
2569938d 232
5bb9aeb2 233
2569938d
VZ
234\membersection{wxFileName::AssignTempFileName}\label{wxfilenameassigntempfilename}
235
df22f860 236\func{void}{AssignTempFileName}{\param{const wxString\& }{prefix}, \param{wxFile *}{fileTemp = {\tt NULL}}}
2569938d 237
ade35f11
VZ
238The function calls \helpref{CreateTempFileName}{wxfilenamecreatetempfilename} to
239create a temporary file and sets this object to the name of the file. If a
240temporary file couldn't be created, the object is put into the\rtfsp
241\helpref{invalid}{wxfilenameisok} state.
2569938d 242
5bb9aeb2 243
2569938d
VZ
244\membersection{wxFileName::Clear}\label{wxfilenameclear}
245
246\func{void}{Clear}{\void}
247
ade35f11
VZ
248Reset all components to default, uninitialized state.
249
5bb9aeb2 250
02a3b391 251\membersection{wxFileName::CreateTempFileName}\label{wxfilenamecreatetempfilename}
ade35f11 252
df22f860 253\func{static wxString}{CreateTempFileName}{\param{const wxString\& }{prefix}, \param{wxFile *}{fileTemp = {\tt NULL}}}
ade35f11
VZ
254
255Returns a temporary file name starting with the given {\it prefix}. If
256the {\it prefix} is an absolute path, the temporary file is created in this
257directory, otherwise it is created in the default system directory for the
258temporary files or in the current directory.
2569938d 259
df22f860
VZ
260If the function succeeds, the temporary file is actually created. If\rtfsp
261{\it fileTemp} is not {\tt NULL}, this file will be opened using the name of
262the temporary file. When possible, this is done in an atomic way ensuring that
263no race condition occurs between the temporary file name generation and opening
264it which could often lead to security compromise on the multiuser systems.
265If {\it fileTemp} is {\tt NULL}, the file is only created, but not opened.
266
267Under Unix, the temporary file will have read and write permissions for the
268owner only to minimize the security problems.
269
270\wxheading{Parameters}
271
272\docparam{prefix}{Prefix to use for the temporary file name construction}
273
274\docparam{fileTemp}{The file to open or {\tt NULL} to just get the name}
ade35f11
VZ
275
276\wxheading{Return value}
277
278The full temporary file name or an empty string on error.
2569938d 279
5bb9aeb2 280
2569938d
VZ
281\membersection{wxFileName::DirExists}\label{wxfilenamedirexists}
282
8e41796c 283\constfunc{bool}{DirExists}{\void}
2569938d 284
8e41796c 285\func{static bool}{DirExists}{\param{const wxString\& }{dir}}
2569938d 286
f363e05c 287Returns {\tt true} if the directory with this name exists.
2569938d 288
5bb9aeb2 289
2569938d
VZ
290\membersection{wxFileName::DirName}\label{wxfilenamedirname}
291
520200fd
VZ
292\func{static wxFileName}{DirName}{\param{const wxString\& }{dir}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
293
294Returns the object corresponding to the directory with the given name.
295The {\it dir} parameter may have trailing path separator or not.
2569938d 296
95c00185 297
5bb9aeb2 298
2569938d
VZ
299\membersection{wxFileName::FileExists}\label{wxfilenamefileexists}
300
8e41796c 301\constfunc{bool}{FileExists}{\void}
2569938d 302
8e41796c 303\func{static bool}{FileExists}{\param{const wxString\& }{file}}
2569938d 304
f363e05c 305Returns {\tt true} if the file with this name exists.
2569938d 306
8e41796c
VZ
307\wxheading{See also}
308
309\helpref{DirExists}{wxfilenamedirexists}
310
520200fd 311
5bb9aeb2 312
2569938d
VZ
313\membersection{wxFileName::FileName}\label{wxfilenamefilename}
314
520200fd
VZ
315\func{static wxFileName}{FileName}{\param{const wxString\& }{file}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
316
317Returns the file name object corresponding to the given {\it file}. This
318function exists mainly for symmetry with \helpref{DirName}{wxfilenamedirname}.
2569938d 319
2569938d 320
5bb9aeb2 321
2569938d
VZ
322\membersection{wxFileName::GetCwd}\label{wxfilenamegetcwd}
323
f363e05c 324\func{static wxString}{GetCwd}{\param{const wxString\& }{volume = ""}}
6f91bc33 325
95c00185 326Retrieves the value of the current working directory on the specified volume. If
6f91bc33
VZ
327the volume is empty, the programs current working directory is returned for the
328current volume.
329
330\wxheading{Return value}
331
332The string containing the current working directory or an empty string on
333error.
2569938d 334
6f91bc33
VZ
335\wxheading{See also}
336
337\helpref{AssignCwd}{wxfilenameassigncwd}
2569938d 338
5bb9aeb2 339
2569938d
VZ
340\membersection{wxFileName::GetDirCount}\label{wxfilenamegetdircount}
341
342\constfunc{size\_t}{GetDirCount}{\void}
343
95c00185 344Returns the number of directories in the file name.
2569938d 345
5bb9aeb2 346
2569938d
VZ
347\membersection{wxFileName::GetDirs}\label{wxfilenamegetdirs}
348
349\constfunc{const wxArrayString\&}{GetDirs}{\void}
350
95c00185 351Returns the directories in string array form.
2569938d 352
5bb9aeb2 353
2569938d
VZ
354\membersection{wxFileName::GetExt}\label{wxfilenamegetext}
355
356\constfunc{wxString}{GetExt}{\void}
357
95c00185 358Returns the file name extension.
2569938d 359
5bb9aeb2 360
f363e05c
VZ
361\membersection{wxFileName::GetForbiddenChars}\label{wxfilenamegetforbiddenchars}
362
363\func{static wxString}{GetForbiddenChars}{\param{wxPathFormat }{format = wxPATH\_NATIVE}}
364
365Returns the characters that can't be used in filenames and directory names for the specified format.
366
5bb9aeb2 367
2569938d
VZ
368\membersection{wxFileName::GetFormat}\label{wxfilenamegetformat}
369
f363e05c 370\func{static wxPathFormat}{GetFormat}{\param{wxPathFormat }{format = wxPATH\_NATIVE}}
2569938d 371
95c00185 372Returns the canonical path format for this platform.
2569938d 373
5bb9aeb2 374
2569938d
VZ
375\membersection{wxFileName::GetFullName}\label{wxfilenamegetfullname}
376
377\constfunc{wxString}{GetFullName}{\void}
378
95c00185 379Returns the full name (including extension but excluding directories).
2569938d 380
5bb9aeb2 381
2569938d
VZ
382\membersection{wxFileName::GetFullPath}\label{wxfilenamegetfullpath}
383
384\constfunc{wxString}{GetFullPath}{\param{wxPathFormat }{format = wxPATH\_NATIVE}}
385
95c00185 386Returns the full path with name and extension.
2569938d 387
5bb9aeb2 388
2569938d
VZ
389\membersection{wxFileName::GetHomeDir}\label{wxfilenamegethomedir}
390
f363e05c 391\func{static wxString}{GetHomeDir}{\void}
2569938d 392
95c00185 393Returns the home directory.
2569938d 394
5bb9aeb2 395
2569938d
VZ
396\membersection{wxFileName::GetLongPath}\label{wxfilenamegetlongpath}
397
398\constfunc{wxString}{GetLongPath}{\void}
399
400Return the long form of the path (returns identity on non-Windows platforms)
401
5bb9aeb2 402
2569938d
VZ
403\membersection{wxFileName::GetModificationTime}\label{wxfilenamegetmodificationtime}
404
405\constfunc{wxDateTime}{GetModificationTime}{\void}
406
95c00185 407Returns the last time the file was last modified.
2569938d 408
5bb9aeb2 409
2569938d
VZ
410\membersection{wxFileName::GetName}\label{wxfilenamegetname}
411
412\constfunc{wxString}{GetName}{\void}
413
95c00185 414Returns the name part of the filename.
2569938d 415
5bb9aeb2 416
2569938d
VZ
417\membersection{wxFileName::GetPath}\label{wxfilenamegetpath}
418
93fa67c0 419\constfunc{wxString}{GetPath}{\param{int }{flags = {\tt wxPATH\_GET\_VOLUME}}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
2569938d 420
95c00185 421Returns the path part of the filename (without the name or extension). The
33b97389 422possible flags values are:
2569938d 423
d1853d47 424\twocolwidtha{5cm}
33b97389 425\begin{twocollist}\itemsep=0pt
d1853d47 426\twocolitem{{\bf wxPATH\_GET\_VOLUME}}{Return the path with the volume (does
93fa67c0
VZ
427nothing for the filename formats without volumes), otherwise the path without
428volume part is returned.}
d1853d47 429\twocolitem{{\bf wxPATH\_GET\_SEPARATOR}}{Return the path with the trailing
33b97389
VZ
430separator, if this flag is not given there will be no separator at the end of
431the path.}
432\end{twocollist}
433
5bb9aeb2 434
33b97389
VZ
435\membersection{wxFileName::GetPathSeparator}\label{wxfilenamegetpathseparator}
436
f363e05c 437\func{static wxChar}{GetPathSeparator}{\param{wxPathFormat }{format = wxPATH\_NATIVE}}
33b97389 438
95c00185 439Returns the usually used path separator for this format. For all formats but
33b97389
VZ
440{\tt wxPATH\_DOS} there is only one path separator anyhow, but for DOS there
441are two of them and the native one, i.e. the backslash is returned by this
442method.
443
444\wxheading{See also}
445
446\helpref{GetPathSeparators}{wxfilenamegetpathseparators}
2569938d 447
5bb9aeb2 448
2569938d
VZ
449\membersection{wxFileName::GetPathSeparators}\label{wxfilenamegetpathseparators}
450
f363e05c 451\func{static wxString}{GetPathSeparators}{\param{wxPathFormat }{format = wxPATH\_NATIVE}}
2569938d 452
95c00185 453Returns the string containing all the path separators for this format. For all
33b97389 454formats but {\tt wxPATH\_DOS} this string contains only one character but for
7af3ca16 455DOS and Windows both {\tt '/'} and {\tt '\textbackslash'} may be used as
33b97389
VZ
456separators.
457
458\wxheading{See also}
2569938d 459
33b97389 460\helpref{GetPathSeparator}{wxfilenamegetpathseparator}
2569938d 461
5bb9aeb2 462
f1e77933
VZ
463\membersection{wxFileName::GetPathTerminators}\label{wxfilenamegetpathterminators}
464
465\func{static wxString}{GetPathTerminators}{\param{wxPathFormat }{format = wxPATH\_NATIVE}}
466
467Returns the string of characters which may terminate the path part. This is the
468same as \helpref{GetPathSeparators}{wxfilenamegetpathseparators} except for VMS
469path format where $]$ is used at the end of the path part.
470
471
2569938d
VZ
472\membersection{wxFileName::GetShortPath}\label{wxfilenamegetshortpath}
473
474\constfunc{wxString}{GetShortPath}{\void}
475
95c00185 476Return the short form of the path (returns identity on non-Windows platforms).
2569938d 477
5bb9aeb2 478
2569938d
VZ
479\membersection{wxFileName::GetTimes}\label{wxfilenamegettimes}
480
6dbb903b 481\constfunc{bool}{GetTimes}{\param{wxDateTime* }{dtAccess}, \param{wxDateTime* }{dtMod}, \param{wxDateTime* }{dtCreate}}
2569938d 482
95c00185 483Returns the last access, last modification and creation times. The last access
ebb39671
VZ
484time is updated whenever the file is read or written (or executed in the case
485of Windows), last modification time is only changed when the file is written
486to. Finally, the creation time is indeed the time when the file was created
487under Windows and the inode change time under Unix (as it is impossible to
488retrieve the real file creation time there anyhow) which can also be changed
489by many operations after the file creation.
2569938d 490
95c00185 491Any of the pointers may be {\tt NULL} if the corresponding time is not
ebb39671
VZ
492needed.
493
494\wxheading{Return value}
495
0894707e 496{\tt true} on success, {\tt false} if we failed to retrieve the times.
2569938d 497
5bb9aeb2 498
2569938d
VZ
499\membersection{wxFileName::GetVolume}\label{wxfilenamegetvolume}
500
501\constfunc{wxString}{GetVolume}{\void}
502
f70c0443 503Returns the string containing the volume for this file name, empty if it
ebb39671
VZ
504doesn't have one or if the file system doesn't support volumes at all (for
505example, Unix).
2569938d 506
5bb9aeb2 507
2569938d
VZ
508\membersection{wxFileName::GetVolumeSeparator}\label{wxfilenamegetvolumeseparator}
509
f363e05c 510\func{static wxString}{GetVolumeSeparator}{\param{wxPathFormat }{format = wxPATH\_NATIVE}}
2569938d 511
95c00185 512Returns the string separating the volume from the path for this format.
2569938d 513
5bb9aeb2 514
2569938d
VZ
515\membersection{wxFileName::HasExt}\label{wxfilenamehasext}
516
517\constfunc{bool}{HasExt}{\void}
518
f363e05c 519Returns {\tt true} if an extension is present.
2569938d 520
5bb9aeb2 521
2569938d
VZ
522\membersection{wxFileName::HasName}\label{wxfilenamehasname}
523
524\constfunc{bool}{HasName}{\void}
525
f363e05c 526Returns {\tt true} if a name is present.
2569938d 527
5bb9aeb2 528
2569938d
VZ
529\membersection{wxFileName::HasVolume}\label{wxfilenamehasvolume}
530
531\constfunc{bool}{HasVolume}{\void}
532
f363e05c 533Returns {\tt true} if a volume specifier is present.
2569938d 534
5bb9aeb2 535
2569938d
VZ
536\membersection{wxFileName::InsertDir}\label{wxfilenameinsertdir}
537
538\func{void}{InsertDir}{\param{int }{before}, \param{const wxString\& }{dir}}
539
5bb9aeb2
VZ
540Inserts a directory component before the zero-based position in the directory
541list. Please see \helpref{AppendDir}{wxfilenameappenddir} for important notes.
542
2569938d
VZ
543
544\membersection{wxFileName::IsAbsolute}\label{wxfilenameisabsolute}
545
546\func{bool}{IsAbsolute}{\param{wxPathFormat }{format = wxPATH\_NATIVE}}
547
f363e05c 548Returns {\tt true} if this filename is absolute.
2569938d 549
5bb9aeb2 550
2569938d
VZ
551\membersection{wxFileName::IsCaseSensitive}\label{wxfilenameiscasesensitive}
552
f363e05c 553\func{static bool}{IsCaseSensitive}{\param{wxPathFormat }{format = wxPATH\_NATIVE}}
2569938d 554
f363e05c 555Returns {\tt true} if the file names of this type are case-sensitive.
2569938d 556
5bb9aeb2 557
2569938d
VZ
558\membersection{wxFileName::IsOk}\label{wxfilenameisok}
559
560\constfunc{bool}{IsOk}{\void}
561
0894707e 562Returns {\tt true} if the filename is valid, {\tt false} if it is not
ade35f11
VZ
563initialized yet. The assignment functions and
564\helpref{Clear}{wxfilenameclear} may reset the object to the uninitialized,
565invalid state (the former only do it on failure).
2569938d 566
5bb9aeb2 567
2569938d
VZ
568\membersection{wxFileName::IsPathSeparator}\label{wxfilenameispathseparator}
569
f363e05c 570\func{static bool}{IsPathSeparator}{\param{wxChar }{ch}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
2569938d 571
0894707e 572Returns {\tt true} if the char is a path separator for this format.
2569938d 573
5bb9aeb2 574
2569938d
VZ
575\membersection{wxFileName::IsRelative}\label{wxfilenameisrelative}
576
577\func{bool}{IsRelative}{\param{wxPathFormat }{format = wxPATH\_NATIVE}}
578
0894707e 579Returns {\tt true} if this filename is not absolute.
2569938d 580
5bb9aeb2 581
2db991f4 582\membersection{wxFileName::IsDir}\label{wxfilenameisdir}
2569938d 583
2db991f4 584\constfunc{bool}{IsDir}{\void}
2569938d 585
0894707e 586Returns {\tt true} if this object represents a directory, {\tt false} otherwise
2db991f4
VZ
587(i.e. if it is a file). Note that this method doesn't test whether the
588directory or file really exists, you should use
589\helpref{DirExists}{wxfilenamedirexists} or
590\helpref{FileExists}{wxfilenamefileexists} for this.
2569938d 591
5bb9aeb2 592
0894707e
VS
593\membersection{wxFileName::MakeAbsolute}\label{wxfilenamemakeabsolute}
594
595\func{bool}{MakeAbsolute}{\param{const wxString\& }{cwd = wxEmptyString}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
596
597Make the file name absolute. This is a shortcut for
598{\tt \helpref{Normalize}{wxfilenamenormalize}(wxPATH\_NORM\_DOTS | wxPATH\_NORM\_ABSOLUTE | wxPATH\_NORM\_TILDE, cwd, format)}.
599
600\wxheading{See also}
601
602\helpref{MakeRelativeTo}{wxfilenamemakerelativeto},
603\helpref{Normalize}{wxfilenamenormalize},
604\helpref{IsAbsolute}{wxfilenameisabsolute}
605
5bb9aeb2 606
f7d886af
VZ
607\membersection{wxFileName::MakeRelativeTo}\label{wxfilenamemakerelativeto}
608
f363e05c 609\func{bool}{MakeRelativeTo}{\param{const wxString\& }{pathBase = wxEmptyString}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
f7d886af
VZ
610
611This function tries to put this file name in a form relative to {\it pathBase}.
612In other words, it returns the file name which should be used to access this
613file if the current directory were {\it pathBase}.
614
615\docparam{pathBase}{the directory to use as root, current directory is used by
616default}
617
618\docparam{format}{the file name format, native by default}
619
620\wxheading{Return value}
621
0894707e 622{\tt true} if the file name has been changed, {\tt false} if we failed to do
f7d886af
VZ
623anything with it (currently this only happens if the file name is on a volume
624different from the volume specified by {\it pathBase}).
625
626\wxheading{See also}
627
628\helpref{Normalize}{wxfilenamenormalize}
2569938d 629
5bb9aeb2 630
2569938d
VZ
631\membersection{wxFileName::Mkdir}\label{wxfilenamemkdir}
632
1527281e 633\func{bool}{Mkdir}{\param{int }{perm = 0777}, \param{int }{flags = $0$}}
2569938d 634
1527281e 635\func{static bool}{Mkdir}{\param{const wxString\& }{dir}, \param{int }{perm = 0777}, \param{int }{flags = $0$}}
2569938d 636
6f91bc33 637\docparam{dir}{the directory to create}
2569938d 638
6f91bc33
VZ
639\docparam{parm}{the permissions for the newly created directory}
640
1527281e
VZ
641\docparam{flags}{if the flags contain {\tt wxPATH\_MKDIR\_FULL} flag,
642try to create each directory in the path and also don't return an error
643if the target directory already exists.}
2569938d 644
6f91bc33 645\wxheading{Return value}
2569938d 646
0894707e 647Returns {\tt true} if the directory was successfully created, {\tt false}
6f91bc33 648otherwise.
2569938d 649
5bb9aeb2 650
2569938d
VZ
651\membersection{wxFileName::Normalize}\label{wxfilenamenormalize}
652
32a0d013 653\func{bool}{Normalize}{\param{int }{flags = wxPATH\_NORM\_ALL}, \param{const wxString\& }{cwd = wxEmptyString}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
2569938d 654
0894707e 655Normalize the path. With the default flags value, the path will be
2569938d 656made absolute, without any ".." and "." and all environment
0894707e
VS
657variables will be expanded in it.
658
659\docparam{flags}{The kind of normalization to do with the file name. It can be
660any or-combination of the following constants:
d2c2afc9 661
0894707e
VS
662\begin{twocollist}
663\twocolitem{{\bf wxPATH\_NORM\_ENV\_VARS}}{replace env vars with their values}
664\twocolitem{{\bf wxPATH\_NORM\_DOTS}}{squeeze all .. and . and prepend cwd}
665\twocolitem{{\bf wxPATH\_NORM\_TILDE}}{Unix only: replace ~ and ~user}
ef92f440 666\twocolitem{{\bf wxPATH\_NORM\_CASE}}{if filesystem is case insensitive, transform to tolower case}
0894707e
VS
667\twocolitem{{\bf wxPATH\_NORM\_ABSOLUTE}}{make the path absolute}
668\twocolitem{{\bf wxPATH\_NORM\_LONG}}{make the path the long form}
21f60945 669\twocolitem{{\bf wxPATH\_NORM\_SHORTCUT}}{resolve if it is a shortcut (Windows only)}
ef92f440 670\twocolitem{{\bf wxPATH\_NORM\_ALL}}{all of previous flags except \texttt{wxPATH\_NORM\_CASE}}
0894707e 671\end{twocollist}
d2c2afc9 672}%
0894707e
VS
673
674\docparam{cwd}{If not empty, this directory will be used instead of current
675working directory in normalization.}
676
677\docparam{format}{The file name format, native by default.}
2569938d 678
5bb9aeb2 679
2569938d
VZ
680\membersection{wxFileName::PrependDir}\label{wxfilenameprependdir}
681
682\func{void}{PrependDir}{\param{const wxString\& }{dir}}
683
5bb9aeb2
VZ
684Prepends a directory to the file path. Please see
685\helpref{AppendDir}{wxfilenameappenddir} for important notes.
686
687
2569938d
VZ
688
689\membersection{wxFileName::RemoveDir}\label{wxfilenameremovedir}
690
691\func{void}{RemoveDir}{\param{int }{pos}}
692
95c00185 693Removes a directory name.
2569938d 694
5bb9aeb2 695
2569938d
VZ
696\membersection{wxFileName::Rmdir}\label{wxfilenamermdir}
697
698\func{bool}{Rmdir}{\void}
699
6f91bc33 700\func{static bool}{Rmdir}{\param{const wxString\& }{dir}}
2569938d 701
95c00185 702Deletes the specified directory from the file system.
2569938d 703
5bb9aeb2 704
2569938d
VZ
705\membersection{wxFileName::SameAs}\label{wxfilenamesameas}
706
2b5f62a0 707\constfunc{bool}{SameAs}{\param{const wxFileName\& }{filepath}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
2569938d 708
95c00185 709Compares the filename using the rules of this platform.
2569938d 710
5bb9aeb2 711
2569938d
VZ
712\membersection{wxFileName::SetCwd}\label{wxfilenamesetcwd}
713
714\func{bool}{SetCwd}{\void}
715
6f91bc33 716\func{static bool}{SetCwd}{\param{const wxString\& }{cwd}}
2569938d 717
95c00185 718Changes the current working directory.
2569938d 719
5bb9aeb2 720
2569938d
VZ
721\membersection{wxFileName::SetExt}\label{wxfilenamesetext}
722
723\func{void}{SetExt}{\param{const wxString\& }{ext}}
724
95c00185 725Sets the extension of this file name.
2569938d 726
5bb9aeb2 727
2569938d
VZ
728\membersection{wxFileName::SetFullName}\label{wxfilenamesetfullname}
729
730\func{void}{SetFullName}{\param{const wxString\& }{fullname}}
731
95c00185 732The full name is the file name and extension (but without the path).
2569938d 733
5bb9aeb2 734
2569938d
VZ
735\membersection{wxFileName::SetName}\label{wxfilenamesetname}
736
737\func{void}{SetName}{\param{const wxString\& }{name}}
738
95c00185 739Sets the name.
2569938d 740
5bb9aeb2 741
2569938d
VZ
742\membersection{wxFileName::SetTimes}\label{wxfilenamesettimes}
743
6dbb903b 744\func{bool}{SetTimes}{\param{const wxDateTime* }{dtAccess}, \param{const wxDateTime* }{dtMod}, \param{const wxDateTime* }{dtCreate}}
2569938d 745
95c00185 746Sets the file creation and last access/modification times (any of the pointers may be NULL).
2569938d 747
5bb9aeb2 748
2569938d
VZ
749\membersection{wxFileName::SetVolume}\label{wxfilenamesetvolume}
750
751\func{void}{SetVolume}{\param{const wxString\& }{volume}}
752
95c00185 753Sets the volume specifier.
2569938d 754
5bb9aeb2 755
2569938d
VZ
756\membersection{wxFileName::SplitPath}\label{wxfilenamesplitpath}
757
2bd25c5a 758\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 759
2bd25c5a 760\func{static void}{SplitPath}{\param{const wxString\& }{fullpath}, \param{wxString* }{path}, \param{wxString* }{name}, \param{wxString* }{ext}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
2569938d 761
2bd25c5a
VZ
762This function splits a full file name into components: the volume (with the
763first version) path (including the volume in the second version), the base name
764and the extension. Any of the output parameters ({\it volume}, {\it path},
765{\it name} or {\it ext}) may be {\tt NULL} if you are not interested in the
766value of a particular component. Also, {\it fullpath} may be empty on entry.
767
768On return, {\it path} contains the file path (without the trailing separator),
769{\it name} contains the file name and {\it ext} contains the file extension
770without leading dot. All three of them may be empty if the corresponding
771component is. The old contents of the strings pointed to by these parameters
772will be overwritten in any case (if the pointers are not {\tt NULL}).
2569938d 773
5bb9aeb2 774
f1e77933
VZ
775\membersection{wxFileName::SplitVolume}\label{wxfilenamesplitvolume}
776
777\func{static void}{SplitVolume}{\param{const wxString\& }{fullpath}, \param{wxString* }{volume}, \param{wxString* }{path}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
778
779Splits the given \arg{fullpath} into the volume part (which may be empty) and
780the pure path part, not containing any volume.
781
782\wxheading{See also}
783
784\helpref{SplitPath}{wxfilenamesplitpath}
785
786
2569938d
VZ
787\membersection{wxFileName::Touch}\label{wxfilenametouch}
788
789\func{bool}{Touch}{\void}
790
95c00185 791Sets the access and modification times to the current moment.
2569938d 792
5bb9aeb2 793
2569938d
VZ
794\membersection{wxFileName::operator=}\label{wxfilenameoperatorassign}
795
796\func{wxFileName\& operator}{operator=}{\param{const wxFileName\& }{filename}}
797
2569938d
VZ
798\func{wxFileName\& operator}{operator=}{\param{const wxString\& }{filename}}
799
6f91bc33 800Assigns the new value to this filename object.
2569938d 801
5bb9aeb2 802
2569938d
VZ
803\membersection{wxFileName::operator==}\label{wxfilenameoperatorequal}
804
2b5f62a0 805\constfunc{bool operator}{operator==}{\param{const wxFileName\& }{filename}}
2569938d 806
2b5f62a0 807\constfunc{bool operator}{operator==}{\param{const wxString\& }{filename}}
2569938d 808
0894707e 809Returns {\tt true} if the filenames are equal. The string {\it filenames} is
2b5f62a0
VZ
810interpreted as a path in the native filename format.
811
5bb9aeb2 812
2b5f62a0
VZ
813\membersection{wxFileName::operator!=}\label{wxfilenameoperatornotequal}
814
815\constfunc{bool operator}{operator!=}{\param{const wxFileName\& }{filename}}
816
817\constfunc{bool operator}{operator!=}{\param{const wxString\& }{filename}}
818
0894707e 819Returns {\tt true} if the filenames are different. The string {\it filenames}
2b5f62a0 820is interpreted as a path in the native filename format.
6f91bc33 821