1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %% Purpose: wxFileName documentation
4 %% Author: Vadim Zeitlin
8 %% Copyright: (c) 2001 Vadim Zeitlin
9 %% License: wxWidgets license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 \section{\class{wxFileName
}}\label{wxfilename
}
14 wxFileName encapsulates a file name. This class serves two purposes: first, it
15 provides the functions to split the file names into components and to recombine
16 these components in the full file name which can then be passed to the OS file
17 functions (and
\helpref{wxWidgets functions
}{filefunctions
} wrapping them).
18 Second, it includes the functions for working with the files itself. Note that
19 to change the file data you should use
\helpref{wxFile
}{wxfile
} class instead.
20 wxFileName provides functions for working with the file attributes.
22 \wxheading{Derived from
}
26 \wxheading{Data structures
}
28 Many 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
32 The path format affects the operation of wxFileName functions in several ways:
33 first and foremost, it defines the path separator character to use, but it also
34 affects other things such as whether the path has the drive part or not.
39 wxPATH_NATIVE =
0, // the path format for the current platform
41 wxPATH_BEOS = wxPATH_UNIX,
44 wxPATH_WIN = wxPATH_DOS,
45 wxPATH_OS2 = wxPATH_DOS,
48 wxPATH_MAX // Not a valid value for specifying path format
52 \latexignore{\rtfignore{\wxheading{Function groups
}}}
55 \membersection{File name format
}
57 wxFileName currently supports the file names in the Unix, DOS/Windows, Mac OS
58 and VMS formats. Although these formats are quite different, wxFileName tries
59 to treat them all in the same generic way. It supposes that all file names
60 consist of the following parts: the volume (also known as drive under Windows
61 or device under VMS), the path which is a sequence of directory names separated
62 by the
\helpref{path separators
}{wxfilenamegetpathseparators
} and the full
63 filename itself which, in turn, is composed from the base file name and the
64 extension. All of the individual components of the file name may be empty and,
65 for example, the volume name is always empty under Unix, but if they are all
66 empty simultaneously, the filename object is considered to be in an invalid
67 state and
\helpref{IsOk
}{wxfilenameisok
} returns
{\tt false
} for it.
69 File names can be case-sensitive or not, the function
\rtfsp
70 \helpref{IsCaseSensitive
}{wxfilenameiscasesensitive
} allows to determine this.
72 The rules for determining if the file name is absolute or relative also depends
73 on the file name format and the only portable way to answer to this question is
74 to use
\helpref{IsAbsolute
}{wxfilenameisabsolute
} method. To ensure that the
75 filename is absolute you may use
\helpref{MakeAbsolute
}{wxfilenamemakeabsolute
}.
76 There is also an inverse function
77 \helpref{MakeRelativeTo
}{wxfilenamemakerelativeto
} which undoes what
78 \helpref{Normalize(wxPATH
\_NORM\_DOTS)
}{wxfilenamenormalize
} does.
80 Other functions returning information about the file format provided by this
81 class are
\helpref{GetVolumeSeparator
}{wxfilenamegetvolumeseparator
},
\rtfsp
82 \helpref{IsPathSeparator
}{wxfilenameispathseparator
}.
84 \helpref{IsRelative
}{wxfilenameisrelative
}
87 \membersection{File name construction
}
92 \membersection{File tests
}
94 Before doing the other tests you should use
\helpref{IsOk
}{wxfilenameisok
} to
95 verify that the filename is well defined. If it is,
96 \helpref{FileExists
}{wxfilenamefileexists
} can be used to test if a file with
97 such name exists and
\helpref{DirExists
}{wxfilenamedirexists
} - if a directory
98 with this name exists.
100 File names should be compared using
\helpref{SameAs
}{wxfilenamesameas
} method
101 or
\helpref{$==$
}{wxfilenameoperatorequal
}.
104 \membersection{File name components
}
106 These functions allow to examine and modify the directories of the path:
108 \helpref{AppendDir
}{wxfilenameappenddir
}\\
109 \helpref{InsertDir
}{wxfilenameinsertdir
}\\
110 \helpref{GetDirCount
}{wxfilenamegetdircount
}
111 \helpref{PrependDir
}{wxfilenameprependdir
}\\
112 \helpref{RemoveDir
}{wxfilenameremovedir
}
114 To change the components of the file name individually you can use the
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
}\\
128 \membersection{Operations
}
130 These methods allow to work with the file creation, access and modification
131 times. Note that not all filesystems under all platforms implement these times
132 in the same way. For example, the access time under Windows has a resolution of
133 one day (so it is really the access date and not time). The access time may be
134 updated when the file is executed or not depending on the platform.
136 \helpref{GetModificationTime
}{wxfilenamegetmodificationtime
}\\
137 \helpref{GetTimes
}{wxfilenamegettimes
}\\
138 \helpref{SetTimes
}{wxfilenamesettimes
}\\
139 \helpref{Touch
}{wxfilenametouch
}
141 Other file system operations functions are:
143 \helpref{Mkdir
}{wxfilenamemkdir
}\\
144 \helpref{Rmdir
}{wxfilenamermdir
}
146 \latexignore{\rtfignore{\wxheading{Members
}}}
149 \membersection{wxFileName::wxFileName
}\label{wxfilenamewxfilename
}
151 \func{}{wxFileName
}{\void}
155 \func{}{wxFileName
}{\param{const wxFileName\&
}{filename
}}
159 \func{}{wxFileName
}{\param{const wxString\&
}{fullpath
},
\param{wxPathFormat
}{format = wxPATH
\_NATIVE}}
161 Constructor taking a full filename. If it terminates with a '/', a directory path
162 is constructed (the name will be empty), otherwise a file name and
163 extension are extracted from it.
165 \func{}{wxFileName
}{\param{const wxString\&
}{path
},
\param{const wxString\&
}{name
},
\param{wxPathFormat
}{format = wxPATH
\_NATIVE}}
167 Constructor from a directory name and a file name.
169 \func{}{wxFileName
}{\param{const wxString\&
}{path
},
\param{const wxString\&
}{name
},
\param{const wxString\&
}{ext
},
\param{wxPathFormat
}{format = wxPATH
\_NATIVE}}
171 Constructor from a directory name, base file name and extension.
173 \func{}{wxFileName
}{\param{const wxString\&
}{volume
},
\param{const wxString\&
}{path
},
\param{const wxString\&
}{name
},
\param{const wxString\&
}{ext
},
\param{wxPathFormat
}{format = wxPATH
\_NATIVE}}
175 Constructor from a volume name, a directory name, base file name and extension.
178 \membersection{wxFileName::AppendDir
}\label{wxfilenameappenddir
}
180 \func{void
}{AppendDir
}{\param{const wxString\&
}{dir
}}
182 Appends a directory component to the path. This component should contain a
183 single directory name level, i.e. not contain any path or volume separators nor
184 should it be empty, otherwise the function does nothing (and generates an
185 assert failure in debug build).
188 \membersection{wxFileName::Assign
}\label{wxfilenameassign
}
190 \func{void
}{Assign
}{\param{const wxFileName\&
}{filepath
}}
192 \func{void
}{Assign
}{\param{const wxString\&
}{fullpath
},
\param{wxPathFormat
}{format = wxPATH
\_NATIVE}}
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}}
196 \func{void
}{Assign
}{\param{const wxString\&
}{path
},
\param{const wxString\&
}{name
},
\param{wxPathFormat
}{format = wxPATH
\_NATIVE}}
198 \func{void
}{Assign
}{\param{const wxString\&
}{path
},
\param{const wxString\&
}{name
},
\param{const wxString\&
}{ext
},
\param{wxPathFormat
}{format = wxPATH
\_NATIVE}}
200 Creates the file name from various combinations of data.
203 \membersection{wxFileName::AssignCwd
}\label{wxfilenameassigncwd
}
205 \func{static void
}{AssignCwd
}{\param{const wxString\&
}{volume = wxEmptyString
}}
207 Makes this object refer to the current working directory on the specified
208 volume (or current volume if
{\it volume
} is empty).
212 \helpref{GetCwd
}{wxfilenamegetcwd
}
215 \membersection{wxFileName::AssignDir
}\label{wxfilenameassigndir
}
217 \func{void
}{AssignDir
}{\param{const wxString\&
}{dir
},
\param{wxPathFormat
}{format = wxPATH
\_NATIVE}}
219 Sets this file name object to the given directory name. The name and extension
223 \membersection{wxFileName::AssignHomeDir
}\label{wxfilenameassignhomedir
}
225 \func{void
}{AssignHomeDir
}{\void}
227 Sets this file name object to the home directory.
230 \membersection{wxFileName::AssignTempFileName
}\label{wxfilenameassigntempfilename
}
232 \func{void
}{AssignTempFileName
}{\param{const wxString\&
}{prefix
},
\param{wxFile *
}{fileTemp =
{\tt NULL
}}}
234 The function calls
\helpref{CreateTempFileName
}{wxfilenamecreatetempfilename
} to
235 create a temporary file and sets this object to the name of the file. If a
236 temporary file couldn't be created, the object is put into the
\rtfsp
237 \helpref{invalid
}{wxfilenameisok
} state.
240 \membersection{wxFileName::Clear
}\label{wxfilenameclear
}
242 \func{void
}{Clear
}{\void}
244 Reset all components to default, uninitialized state.
247 \membersection{wxFileName::CreateTempFileName
}\label{wxfilenamecreatetempfilename
}
249 \func{static wxString
}{CreateTempFileName
}{\param{const wxString\&
}{prefix
},
\param{wxFile *
}{fileTemp =
{\tt NULL
}}}
251 Returns a temporary file name starting with the given
{\it prefix
}. If
252 the
{\it prefix
} is an absolute path, the temporary file is created in this
253 directory, otherwise it is created in the default system directory for the
254 temporary files or in the current directory.
256 If 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
258 the temporary file. When possible, this is done in an atomic way ensuring that
259 no race condition occurs between the temporary file name generation and opening
260 it which could often lead to security compromise on the multiuser systems.
261 If
{\it fileTemp
} is
{\tt NULL
}, the file is only created, but not opened.
263 Under Unix, the temporary file will have read and write permissions for the
264 owner only to minimize the security problems.
266 \wxheading{Parameters
}
268 \docparam{prefix
}{Prefix to use for the temporary file name construction
}
270 \docparam{fileTemp
}{The file to open or
{\tt NULL
} to just get the name
}
272 \wxheading{Return value
}
274 The full temporary file name or an empty string on error.
277 \membersection{wxFileName::DirExists
}\label{wxfilenamedirexists
}
279 \constfunc{bool
}{DirExists
}{\void}
281 \func{static bool
}{DirExists
}{\param{const wxString\&
}{dir
}}
283 Returns
{\tt true
} if the directory with this name exists.
286 \membersection{wxFileName::DirName
}\label{wxfilenamedirname
}
288 \func{static wxFileName
}{DirName
}{\param{const wxString\&
}{dir
},
\param{wxPathFormat
}{format = wxPATH
\_NATIVE}}
290 Returns the object corresponding to the directory with the given name.
291 The
{\it dir
} parameter may have trailing path separator or not.
295 \membersection{wxFileName::FileExists
}\label{wxfilenamefileexists
}
297 \constfunc{bool
}{FileExists
}{\void}
299 \func{static bool
}{FileExists
}{\param{const wxString\&
}{file
}}
301 Returns
{\tt true
} if the file with this name exists.
305 \helpref{DirExists
}{wxfilenamedirexists
}
309 \membersection{wxFileName::FileName
}\label{wxfilenamefilename
}
311 \func{static wxFileName
}{FileName
}{\param{const wxString\&
}{file
},
\param{wxPathFormat
}{format = wxPATH
\_NATIVE}}
313 Returns the file name object corresponding to the given
{\it file
}. This
314 function exists mainly for symmetry with
\helpref{DirName
}{wxfilenamedirname
}.
318 \membersection{wxFileName::GetCwd
}\label{wxfilenamegetcwd
}
320 \func{static wxString
}{GetCwd
}{\param{const wxString\&
}{volume = ""
}}
322 Retrieves the value of the current working directory on the specified volume. If
323 the volume is empty, the programs current working directory is returned for the
326 \wxheading{Return value
}
328 The string containing the current working directory or an empty string on
333 \helpref{AssignCwd
}{wxfilenameassigncwd
}
336 \membersection{wxFileName::GetDirCount
}\label{wxfilenamegetdircount
}
338 \constfunc{size
\_t}{GetDirCount
}{\void}
340 Returns the number of directories in the file name.
343 \membersection{wxFileName::GetDirs
}\label{wxfilenamegetdirs
}
345 \constfunc{const wxArrayString\&
}{GetDirs
}{\void}
347 Returns the directories in string array form.
350 \membersection{wxFileName::GetExt
}\label{wxfilenamegetext
}
352 \constfunc{wxString
}{GetExt
}{\void}
354 Returns the file name extension.
357 \membersection{wxFileName::GetForbiddenChars
}\label{wxfilenamegetforbiddenchars
}
359 \func{static wxString
}{GetForbiddenChars
}{\param{wxPathFormat
}{format = wxPATH
\_NATIVE}}
361 Returns the characters that can't be used in filenames and directory names for the specified format.
364 \membersection{wxFileName::GetFormat
}\label{wxfilenamegetformat
}
366 \func{static wxPathFormat
}{GetFormat
}{\param{wxPathFormat
}{format = wxPATH
\_NATIVE}}
368 Returns the canonical path format for this platform.
371 \membersection{wxFileName::GetFullName
}\label{wxfilenamegetfullname
}
373 \constfunc{wxString
}{GetFullName
}{\void}
375 Returns the full name (including extension but excluding directories).
378 \membersection{wxFileName::GetFullPath
}\label{wxfilenamegetfullpath
}
380 \constfunc{wxString
}{GetFullPath
}{\param{wxPathFormat
}{format = wxPATH
\_NATIVE}}
382 Returns the full path with name and extension.
385 \membersection{wxFileName::GetHomeDir
}\label{wxfilenamegethomedir
}
387 \func{static wxString
}{GetHomeDir
}{\void}
389 Returns the home directory.
392 \membersection{wxFileName::GetLongPath
}\label{wxfilenamegetlongpath
}
394 \constfunc{wxString
}{GetLongPath
}{\void}
396 Return the long form of the path (returns identity on non-Windows platforms)
399 \membersection{wxFileName::GetModificationTime
}\label{wxfilenamegetmodificationtime
}
401 \constfunc{wxDateTime
}{GetModificationTime
}{\void}
403 Returns the last time the file was last modified.
406 \membersection{wxFileName::GetName
}\label{wxfilenamegetname
}
408 \constfunc{wxString
}{GetName
}{\void}
410 Returns the name part of the filename.
413 \membersection{wxFileName::GetPath
}\label{wxfilenamegetpath
}
415 \constfunc{wxString
}{GetPath
}{\param{int
}{flags =
{\tt wxPATH
\_GET\_VOLUME}},
\param{wxPathFormat
}{format = wxPATH
\_NATIVE}}
417 Returns the path part of the filename (without the name or extension). The
418 possible flags values are:
421 \begin{twocollist
}\itemsep=
0pt
422 \twocolitem{{\bf wxPATH
\_GET\_VOLUME}}{Return the path with the volume (does
423 nothing for the filename formats without volumes), otherwise the path without
424 volume part is returned.
}
425 \twocolitem{{\bf wxPATH
\_GET\_SEPARATOR}}{Return the path with the trailing
426 separator, if this flag is not given there will be no separator at the end of
431 \membersection{wxFileName::GetPathSeparator
}\label{wxfilenamegetpathseparator
}
433 \func{static wxChar
}{GetPathSeparator
}{\param{wxPathFormat
}{format = wxPATH
\_NATIVE}}
435 Returns the usually used path separator for this format. For all formats but
436 {\tt wxPATH
\_DOS} there is only one path separator anyhow, but for DOS there
437 are two of them and the native one, i.e. the backslash is returned by this
442 \helpref{GetPathSeparators
}{wxfilenamegetpathseparators
}
445 \membersection{wxFileName::GetPathSeparators
}\label{wxfilenamegetpathseparators
}
447 \func{static wxString
}{GetPathSeparators
}{\param{wxPathFormat
}{format = wxPATH
\_NATIVE}}
449 Returns the string containing all the path separators for this format. For all
450 formats but
{\tt wxPATH
\_DOS} this string contains only one character but for
451 DOS and Windows both
{\tt '/'
} and
{\tt '
\textbackslash'
} may be used as
456 \helpref{GetPathSeparator
}{wxfilenamegetpathseparator
}
459 \membersection{wxFileName::GetShortPath
}\label{wxfilenamegetshortpath
}
461 \constfunc{wxString
}{GetShortPath
}{\void}
463 Return the short form of the path (returns identity on non-Windows platforms).
466 \membersection{wxFileName::GetTimes
}\label{wxfilenamegettimes
}
468 \constfunc{bool
}{GetTimes
}{\param{wxDateTime*
}{dtAccess
},
\param{wxDateTime*
}{dtMod
},
\param{wxDateTime*
}{dtCreate
}}
470 Returns the last access, last modification and creation times. The last access
471 time is updated whenever the file is read or written (or executed in the case
472 of Windows), last modification time is only changed when the file is written
473 to. Finally, the creation time is indeed the time when the file was created
474 under Windows and the inode change time under Unix (as it is impossible to
475 retrieve the real file creation time there anyhow) which can also be changed
476 by many operations after the file creation.
478 Any of the pointers may be
{\tt NULL
} if the corresponding time is not
481 \wxheading{Return value
}
483 {\tt true
} on success,
{\tt false
} if we failed to retrieve the times.
486 \membersection{wxFileName::GetVolume
}\label{wxfilenamegetvolume
}
488 \constfunc{wxString
}{GetVolume
}{\void}
490 Returns the string containing the volume for this file name, mepty if it
491 doesn't have one or if the file system doesn't support volumes at all (for
495 \membersection{wxFileName::GetVolumeSeparator
}\label{wxfilenamegetvolumeseparator
}
497 \func{static wxString
}{GetVolumeSeparator
}{\param{wxPathFormat
}{format = wxPATH
\_NATIVE}}
499 Returns the string separating the volume from the path for this format.
502 \membersection{wxFileName::HasExt
}\label{wxfilenamehasext
}
504 \constfunc{bool
}{HasExt
}{\void}
506 Returns
{\tt true
} if an extension is present.
509 \membersection{wxFileName::HasName
}\label{wxfilenamehasname
}
511 \constfunc{bool
}{HasName
}{\void}
513 Returns
{\tt true
} if a name is present.
516 \membersection{wxFileName::HasVolume
}\label{wxfilenamehasvolume
}
518 \constfunc{bool
}{HasVolume
}{\void}
520 Returns
{\tt true
} if a volume specifier is present.
523 \membersection{wxFileName::InsertDir
}\label{wxfilenameinsertdir
}
525 \func{void
}{InsertDir
}{\param{int
}{before
},
\param{const wxString\&
}{dir
}}
527 Inserts a directory component before the zero-based position in the directory
528 list. Please see
\helpref{AppendDir
}{wxfilenameappenddir
} for important notes.
531 \membersection{wxFileName::IsAbsolute
}\label{wxfilenameisabsolute
}
533 \func{bool
}{IsAbsolute
}{\param{wxPathFormat
}{format = wxPATH
\_NATIVE}}
535 Returns
{\tt true
} if this filename is absolute.
538 \membersection{wxFileName::IsCaseSensitive
}\label{wxfilenameiscasesensitive
}
540 \func{static bool
}{IsCaseSensitive
}{\param{wxPathFormat
}{format = wxPATH
\_NATIVE}}
542 Returns
{\tt true
} if the file names of this type are case-sensitive.
545 \membersection{wxFileName::IsOk
}\label{wxfilenameisok
}
547 \constfunc{bool
}{IsOk
}{\void}
549 Returns
{\tt true
} if the filename is valid,
{\tt false
} if it is not
550 initialized yet. The assignment functions and
551 \helpref{Clear
}{wxfilenameclear
} may reset the object to the uninitialized,
552 invalid state (the former only do it on failure).
555 \membersection{wxFileName::IsPathSeparator
}\label{wxfilenameispathseparator
}
557 \func{static bool
}{IsPathSeparator
}{\param{wxChar
}{ch
},
\param{wxPathFormat
}{format = wxPATH
\_NATIVE}}
559 Returns
{\tt true
} if the char is a path separator for this format.
562 \membersection{wxFileName::IsRelative
}\label{wxfilenameisrelative
}
564 \func{bool
}{IsRelative
}{\param{wxPathFormat
}{format = wxPATH
\_NATIVE}}
566 Returns
{\tt true
} if this filename is not absolute.
569 \membersection{wxFileName::IsDir
}\label{wxfilenameisdir
}
571 \constfunc{bool
}{IsDir
}{\void}
573 Returns
{\tt true
} if this object represents a directory,
{\tt false
} otherwise
574 (i.e. if it is a file). Note that this method doesn't test whether the
575 directory or file really exists, you should use
576 \helpref{DirExists
}{wxfilenamedirexists
} or
577 \helpref{FileExists
}{wxfilenamefileexists
} for this.
580 \membersection{wxFileName::MakeAbsolute
}\label{wxfilenamemakeabsolute
}
582 \func{bool
}{MakeAbsolute
}{\param{const wxString\&
}{cwd = wxEmptyString
},
\param{wxPathFormat
}{format = wxPATH
\_NATIVE}}
584 Make 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)
}.
589 \helpref{MakeRelativeTo
}{wxfilenamemakerelativeto
},
590 \helpref{Normalize
}{wxfilenamenormalize
},
591 \helpref{IsAbsolute
}{wxfilenameisabsolute
}
594 \membersection{wxFileName::MakeRelativeTo
}\label{wxfilenamemakerelativeto
}
596 \func{bool
}{MakeRelativeTo
}{\param{const wxString\&
}{pathBase = wxEmptyString
},
\param{wxPathFormat
}{format = wxPATH
\_NATIVE}}
598 This function tries to put this file name in a form relative to
{\it pathBase
}.
599 In other words, it returns the file name which should be used to access this
600 file if the current directory were
{\it pathBase
}.
602 \docparam{pathBase
}{the directory to use as root, current directory is used by
605 \docparam{format
}{the file name format, native by default
}
607 \wxheading{Return value
}
609 {\tt true
} if the file name has been changed,
{\tt false
} if we failed to do
610 anything with it (currently this only happens if the file name is on a volume
611 different from the volume specified by
{\it pathBase
}).
615 \helpref{Normalize
}{wxfilenamenormalize
}
618 \membersection{wxFileName::Mkdir
}\label{wxfilenamemkdir
}
620 \func{bool
}{Mkdir
}{\param{int
}{perm =
0777},
\param{int
}{flags = $
0$
}}
622 \func{static bool
}{Mkdir
}{\param{const wxString\&
}{dir
},
\param{int
}{perm =
0777},
\param{int
}{flags = $
0$
}}
624 \docparam{dir
}{the directory to create
}
626 \docparam{parm
}{the permissions for the newly created directory
}
628 \docparam{flags
}{if the flags contain
{\tt wxPATH
\_MKDIR\_FULL} flag,
629 try to create each directory in the path and also don't return an error
630 if the target directory already exists.
}
632 \wxheading{Return value
}
634 Returns
{\tt true
} if the directory was successfully created,
{\tt false
}
638 \membersection{wxFileName::Normalize
}\label{wxfilenamenormalize
}
640 \func{bool
}{Normalize
}{\param{int
}{flags = wxPATH
\_NORM\_ALL},
\param{const wxString\&
}{cwd = wxEmptyString
},
\param{wxPathFormat
}{format = wxPATH
\_NATIVE}}
642 Normalize the path. With the default flags value, the path will be
643 made absolute, without any ".." and "." and all environment
644 variables will be expanded in it.
646 \docparam{flags
}{The kind of normalization to do with the file name. It can be
647 any or-combination of the following constants:
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
}
653 \twocolitem{{\bf wxPATH
\_NORM\_CASE}}{if filesystem is case insensitive, transform to tolower case
}
654 \twocolitem{{\bf wxPATH
\_NORM\_ABSOLUTE}}{make the path absolute
}
655 \twocolitem{{\bf wxPATH
\_NORM\_LONG}}{make the path the long form
}
656 \twocolitem{{\bf wxPATH
\_NORM\_SHORTCUT}}{resolve if it is a shortcut (Windows only)
}
657 \twocolitem{{\bf wxPATH
\_NORM\_ALL}}{all of previous flags except
\texttt{wxPATH
\_NORM\_CASE}}
661 \docparam{cwd
}{If not empty, this directory will be used instead of current
662 working directory in normalization.
}
664 \docparam{format
}{The file name format, native by default.
}
667 \membersection{wxFileName::PrependDir
}\label{wxfilenameprependdir
}
669 \func{void
}{PrependDir
}{\param{const wxString\&
}{dir
}}
671 Prepends a directory to the file path. Please see
672 \helpref{AppendDir
}{wxfilenameappenddir
} for important notes.
676 \membersection{wxFileName::RemoveDir
}\label{wxfilenameremovedir
}
678 \func{void
}{RemoveDir
}{\param{int
}{pos
}}
680 Removes a directory name.
683 \membersection{wxFileName::Rmdir
}\label{wxfilenamermdir
}
685 \func{bool
}{Rmdir
}{\void}
687 \func{static bool
}{Rmdir
}{\param{const wxString\&
}{dir
}}
689 Deletes the specified directory from the file system.
692 \membersection{wxFileName::SameAs
}\label{wxfilenamesameas
}
694 \constfunc{bool
}{SameAs
}{\param{const wxFileName\&
}{filepath
},
\param{wxPathFormat
}{format = wxPATH
\_NATIVE}}
696 Compares the filename using the rules of this platform.
699 \membersection{wxFileName::SetCwd
}\label{wxfilenamesetcwd
}
701 \func{bool
}{SetCwd
}{\void}
703 \func{static bool
}{SetCwd
}{\param{const wxString\&
}{cwd
}}
705 Changes the current working directory.
708 \membersection{wxFileName::SetExt
}\label{wxfilenamesetext
}
710 \func{void
}{SetExt
}{\param{const wxString\&
}{ext
}}
712 Sets the extension of this file name.
715 \membersection{wxFileName::SetFullName
}\label{wxfilenamesetfullname
}
717 \func{void
}{SetFullName
}{\param{const wxString\&
}{fullname
}}
719 The full name is the file name and extension (but without the path).
722 \membersection{wxFileName::SetName
}\label{wxfilenamesetname
}
724 \func{void
}{SetName
}{\param{const wxString\&
}{name
}}
729 \membersection{wxFileName::SetTimes
}\label{wxfilenamesettimes
}
731 \func{bool
}{SetTimes
}{\param{const wxDateTime*
}{dtAccess
},
\param{const wxDateTime*
}{dtMod
},
\param{const wxDateTime*
}{dtCreate
}}
733 Sets the file creation and last access/modification times (any of the pointers may be NULL).
736 \membersection{wxFileName::SetVolume
}\label{wxfilenamesetvolume
}
738 \func{void
}{SetVolume
}{\param{const wxString\&
}{volume
}}
740 Sets the volume specifier.
743 \membersection{wxFileName::SplitPath
}\label{wxfilenamesplitpath
}
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}}
747 \func{static void
}{SplitPath
}{\param{const wxString\&
}{fullpath
},
\param{wxString*
}{path
},
\param{wxString*
}{name
},
\param{wxString*
}{ext
},
\param{wxPathFormat
}{format = wxPATH
\_NATIVE}}
749 This function splits a full file name into components: the volume (with the
750 first version) path (including the volume in the second version), the base name
751 and 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
753 value of a particular component. Also,
{\it fullpath
} may be empty on entry.
755 On 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
757 without leading dot. All three of them may be empty if the corresponding
758 component is. The old contents of the strings pointed to by these parameters
759 will be overwritten in any case (if the pointers are not
{\tt NULL
}).
762 \membersection{wxFileName::Touch
}\label{wxfilenametouch
}
764 \func{bool
}{Touch
}{\void}
766 Sets the access and modification times to the current moment.
769 \membersection{wxFileName::operator=
}\label{wxfilenameoperatorassign
}
771 \func{wxFileName\& operator
}{operator=
}{\param{const wxFileName\&
}{filename
}}
773 \func{wxFileName\& operator
}{operator=
}{\param{const wxString\&
}{filename
}}
775 Assigns the new value to this filename object.
778 \membersection{wxFileName::operator==
}\label{wxfilenameoperatorequal
}
780 \constfunc{bool operator
}{operator==
}{\param{const wxFileName\&
}{filename
}}
782 \constfunc{bool operator
}{operator==
}{\param{const wxString\&
}{filename
}}
784 Returns
{\tt true
} if the filenames are equal. The string
{\it filenames
} is
785 interpreted as a path in the native filename format.
788 \membersection{wxFileName::operator!=
}\label{wxfilenameoperatornotequal
}
790 \constfunc{bool operator
}{operator!=
}{\param{const wxFileName\&
}{filename
}}
792 \constfunc{bool operator
}{operator!=
}{\param{const wxString\&
}{filename
}}
794 Returns
{\tt true
} if the filenames are different. The string
{\it filenames
}
795 is interpreted as a path in the native filename format.