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