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