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