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