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