]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/filename.h
Set svn properties on recently added files.
[wxWidgets.git] / interface / wx / filename.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: filename.h
e54c96f1 3// Purpose: interface of wxFileName
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
526954c5 6// Licence: wxWindows licence
23324ae1
FM
7/////////////////////////////////////////////////////////////////////////////
8
0b70c946 9
eadd3970
FM
10/**
11 The various values for the path format: this mainly affects the path
0b70c946
FM
12 separator but also whether or not the path has the drive part
13 (as under Windows).
14
15 See wxFileName for more info.
16*/
17enum wxPathFormat
18{
19 wxPATH_NATIVE = 0, //!< the path format for the current platform.
20 wxPATH_UNIX,
21 wxPATH_BEOS = wxPATH_UNIX,
22 wxPATH_MAC,
23 wxPATH_DOS,
24 wxPATH_WIN = wxPATH_DOS,
25 wxPATH_OS2 = wxPATH_DOS,
26 wxPATH_VMS,
27
28 wxPATH_MAX //!< Not a valid value for specifying path format
29};
30
b2edb8f3
VZ
31/**
32 Different conventions for human readable sizes.
33
34 @see wxFileName::GetHumanReadableSize().
35
36 @since 2.9.1
37*/
38enum wxSizeConvention
39{
72822505
VZ
40 /// 1024 bytes = 1KB.
41 wxSIZE_CONV_TRADITIONAL,
42
43 /// 1024 bytes = 1KiB.
2febffba 44 wxSIZE_CONV_IEC,
b2edb8f3
VZ
45
46 /// 1000 bytes = 1KB.
72822505 47 wxSIZE_CONV_SI
b2edb8f3
VZ
48};
49
0b70c946 50
eadd3970
FM
51/**
52 The kind of normalization to do with the file name: these values can be
0b70c946
FM
53 or'd together to perform several operations at once.
54 See wxFileName::Normalize() for more info.
55*/
56enum wxPathNormalize
57{
395f3aa8
FM
58 //! Replace environment variables with their values.
59 //! wxFileName understands both Unix and Windows (but only under Windows) environment
60 //! variables expansion: i.e. @c "$var", @c "$(var)" and @c "${var}" are always understood
61 //! and in addition under Windows @c "%var%" is also.
62 wxPATH_NORM_ENV_VARS = 0x0001,
63
31eacdaf 64 wxPATH_NORM_DOTS = 0x0002, //!< Squeeze all @c ".." and @c ".".
eadd3970
FM
65 wxPATH_NORM_TILDE = 0x0004, //!< Replace @c "~" and @c "~user" (Unix only).
66 wxPATH_NORM_CASE = 0x0008, //!< If the platform is case insensitive, make lowercase the path.
67 wxPATH_NORM_ABSOLUTE = 0x0010, //!< Make the path absolute.
68 wxPATH_NORM_LONG = 0x0020, //!< Expand the path to the "long" form (Windows only).
69 wxPATH_NORM_SHORTCUT = 0x0040, //!< Resolve the shortcut, if it is a shortcut (Windows only).
70
71 //! A value indicating all normalization flags except for @c wxPATH_NORM_CASE.
0b70c946
FM
72 wxPATH_NORM_ALL = 0x00ff & ~wxPATH_NORM_CASE
73};
74
110c5094
VZ
75/**
76 Flags for wxFileName::Rmdir().
77 */
78enum
79{
80 /// Delete the specified directory and its subdirectories if they are empty.
81 wxPATH_RMDIR_FULL = 1,
82
83 /**
84 Delete the specified directory and all the files and subdirectories in it
85 recursively.
86
87 This flag is obviously @b dangerous and should be used with care and
88 after asking the user for confirmation.
89 */
90 wxPATH_RMDIR_RECURSIVE = 2
91};
92
0b70c946
FM
93/**
94 The return value of wxFileName::GetSize() in case of error.
95*/
96wxULongLong wxInvalidSize;
97
98
23324ae1
FM
99/**
100 @class wxFileName
7c913512 101
76e9224e
FM
102 wxFileName encapsulates a file name.
103
104 This class serves two purposes: first, it provides the functions to split the
105 file names into components and to recombine these components in the full file
106 name which can then be passed to the OS file functions
107 (and @ref group_funcmacro_file "wxWidgets functions" wrapping them).
23324ae1
FM
108 Second, it includes the functions for working with the files itself. Note that
109 to change the file data you should use wxFile class instead.
110 wxFileName provides functions for working with the file attributes.
7c913512 111
23324ae1
FM
112 When working with directory names (i.e. without filename and extension)
113 make sure not to misuse the file name part of this class with the last
114 directory. Instead initialize the wxFileName instance like this:
7c913512 115
23324ae1
FM
116 @code
117 wxFileName dirname( "C:\mydir", "" );
118 MyMethod( dirname.GetPath() );
119 @endcode
7c913512 120
0b70c946 121 The same can be done using the static method wxFileName::DirName():
7c913512 122
23324ae1
FM
123 @code
124 wxFileName dirname = wxFileName::DirName( "C:\mydir" );
125 MyMethod( dirname.GetPath() );
126 @endcode
7c913512 127
0b70c946
FM
128 Accordingly, methods dealing with directories or directory names like
129 wxFileName::IsDirReadable() use wxFileName::GetPath() whereas methods dealing
130 with file names like wxFileName::IsFileReadable() use wxFileName::GetFullPath().
7c913512 131
d13b34d3 132 If it is not known whether a string contains a directory name or a complete
0b70c946
FM
133 file name (such as when interpreting user input) you need to use the static
134 function wxFileName::DirExists() (or its identical variants wxDir::Exists() and
135 wxDirExists()) and construct the wxFileName instance accordingly.
136 This will only work if the directory actually exists, of course:
7c913512 137
23324ae1
FM
138 @code
139 wxString user_input;
140 // get input from user
7c913512 141
23324ae1
FM
142 wxFileName fname;
143 if (wxDirExists(user_input))
144 fname.AssignDir( user_input );
145 else
146 fname.Assign( user_input );
147 @endcode
7c913512 148
0b70c946
FM
149 Please note that many wxFileName methods accept the path format argument
150 which is by @c wxPATH_NATIVE by default meaning to use the path format
151 native for the current platform.
152 The path format affects the operation of wxFileName functions in several ways:
153 first and foremost, it defines the path separator character to use, but it
154 also affects other things such as whether the path has the drive part or not.
155 See wxPathFormat for more info.
156
157
158 @section filename_format File name format
159
160 wxFileName currently supports the file names in the Unix, DOS/Windows,
161 Mac OS and VMS formats. Although these formats are quite different,
162 wxFileName tries to treat them all in the same generic way.
163 It supposes that all file names consist of the following parts: the volume
164 (also known as drive under Windows or device under VMS), the path which is
165 a sequence of directory names separated by the path separators and the full
166 filename itself which, in turn, is composed from the base file name and the
167 extension. All of the individual components of the file name may be empty
168 and, for example, the volume name is always empty under Unix, but if they
169 are all empty simultaneously, the filename object is considered to be in an
170 invalid state and wxFileName::IsOk() returns false for it.
171
172 File names can be case-sensitive or not, the function wxFileName::IsCaseSensitive()
173 allows to determine this. The rules for determining whether the file name is
174 absolute or relative also depend on the file name format and the only portable way
175 to answer this question is to use wxFileName::IsAbsolute() or wxFileName::IsRelative()
176 method.
177
178 Note that on Windows,"X:" refers to the current working directory on drive X.
179 Therefore, a wxFileName instance constructed from for example "X:dir/file.ext"
180 treats the portion beyond drive separator as being relative to that directory.
181 To ensure that the filename is absolute, you may use wxFileName::MakeAbsolute().
182 There is also an inverse function wxFileName::MakeRelativeTo() which undoes
183 what wxFileName::Normalize(wxPATH_NORM_DOTS) does.
184 Other functions returning information about the file format provided by this
185 class are wxFileName::GetVolumeSeparator(), wxFileName::IsPathSeparator().
186
187
188 @section filename_construction File name construction
189
190 You can initialize a wxFileName instance using one of the following functions:
191
192 @li wxFileName::wxFileName()
193 @li wxFileName::Assign()
194 @li wxFileName::AssignCwd()
195 @li wxFileName::AssignDir()
196 @li wxFileName::AssignHomeDir()
f95032ca 197 @li wxFileName::AssignTempFileName()
0b70c946
FM
198 @li wxFileName::DirName()
199 @li wxFileName::FileName()
200 @li wxFileName::operator=()
201
202
203 @section filename_tests File name tests
204
205 Before doing other tests, you should use wxFileName::IsOk() to verify that
206 the filename is well defined. If it is, FileExists() can be used to test whether
207 a file with such name exists and wxFileName::DirExists() can be used to test
208 for directory existence.
209 File names should be compared using the wxFileName::SameAs() method or
210 wxFileName::operator==(). For testing basic access modes, you can use:
211
212 @li wxFileName::IsDirWritable()
213 @li wxFileName::IsDirReadable()
214 @li wxFileName::IsFileWritable()
215 @li wxFileName::IsFileReadable()
216 @li wxFileName::IsFileExecutable()
217
218
219 @section filename_components File name components
220
221 These functions allow to examine and modify the individual directories
222 of the path:
223
224 @li wxFileName::AppendDir()
225 @li wxFileName::InsertDir()
226 @li wxFileName::GetDirCount()
227 @li wxFileName::PrependDir()
228 @li wxFileName::RemoveDir()
229 @li wxFileName::RemoveLastDir()
230
231 To change the components of the file name individually you can use the
232 following functions:
233
234 @li wxFileName::GetExt()
235 @li wxFileName::GetName()
236 @li wxFileName::GetVolume()
237 @li wxFileName::HasExt()
238 @li wxFileName::HasName()
239 @li wxFileName::HasVolume()
240 @li wxFileName::SetExt()
241 @li wxFileName::ClearExt()
242 @li wxFileName::SetEmptyExt()
243 @li wxFileName::SetName()
244 @li wxFileName::SetVolume()
245
246 You can initialize a wxFileName instance using one of the following functions:
247
248
249 @section filename_operations File name operations
250
251 These methods allow to work with the file creation, access and modification
252 times. Note that not all filesystems under all platforms implement these times
253 in the same way. For example, the access time under Windows has a resolution of
254 one day (so it is really the access date and not time). The access time may be
255 updated when the file is executed or not depending on the platform.
256
257 @li wxFileName::GetModificationTime()
258 @li wxFileName::GetTimes()
259 @li wxFileName::SetTimes()
260 @li wxFileName::Touch()
261
262 Other file system operations functions are:
263
264 @li wxFileName::Mkdir()
265 @li wxFileName::Rmdir()
ca4bcd88
RR
266
267
23324ae1
FM
268 @library{wxbase}
269 @category{file}
23324ae1 270*/
7c913512 271class wxFileName
23324ae1
FM
272{
273public:
23324ae1 274 /**
ca4bcd88 275 Default constructor.
23324ae1
FM
276 */
277 wxFileName();
0b70c946 278
ca4bcd88
RR
279 /**
280 Copy constructor.
281 */
7c913512 282 wxFileName(const wxFileName& filename);
0b70c946 283
ca4bcd88 284 /**
0b70c946
FM
285 Constructor taking a full filename.
286
287 If it terminates with a '/', a directory path is constructed
288 (the name will be empty), otherwise a file name and extension
289 are extracted from it.
ca4bcd88 290 */
7c913512
FM
291 wxFileName(const wxString& fullpath,
292 wxPathFormat format = wxPATH_NATIVE);
0b70c946 293
ca4bcd88
RR
294 /**
295 Constructor a directory name and file name.
296 */
7c913512
FM
297 wxFileName(const wxString& path, const wxString& name,
298 wxPathFormat format = wxPATH_NATIVE);
0b70c946 299
ca4bcd88
RR
300 /**
301 Constructor from a directory name, base file name and extension.
302 */
7c913512
FM
303 wxFileName(const wxString& path, const wxString& name,
304 const wxString& ext,
305 wxPathFormat format = wxPATH_NATIVE);
0b70c946 306
ca4bcd88
RR
307 /**
308 Constructor from a volume name, a directory name, base file name and extension.
309 */
7c913512
FM
310 wxFileName(const wxString& volume, const wxString& path,
311 const wxString& name,
312 const wxString& ext,
313 wxPathFormat format = wxPATH_NATIVE);
23324ae1
FM
314
315 /**
316 Appends a directory component to the path. This component should contain a
317 single directory name level, i.e. not contain any path or volume separators nor
318 should it be empty, otherwise the function does nothing (and generates an
319 assert failure in debug build).
320 */
321 void AppendDir(const wxString& dir);
322
23324ae1 323 /**
ca4bcd88 324 Creates the file name from another filename object.
23324ae1
FM
325 */
326 void Assign(const wxFileName& filepath);
0b70c946 327
ca4bcd88
RR
328 /**
329 Creates the file name from a full file name with a path.
330 */
7c913512
FM
331 void Assign(const wxString& fullpath,
332 wxPathFormat format = wxPATH_NATIVE);
0b70c946 333
ca4bcd88 334 /**
d13b34d3 335 Creates the file name from volume, path, name and extension.
ca4bcd88 336 */
7c913512
FM
337 void Assign(const wxString& volume, const wxString& path,
338 const wxString& name,
339 const wxString& ext,
340 bool hasExt,
341 wxPathFormat format = wxPATH_NATIVE);
0b70c946 342
ca4bcd88 343 /**
d13b34d3 344 Creates the file name from volume, path, name and extension.
ca4bcd88 345 */
7c913512
FM
346 void Assign(const wxString& volume, const wxString& path,
347 const wxString& name,
348 const wxString& ext,
349 wxPathFormat format = wxPATH_NATIVE);
0b70c946 350
ca4bcd88
RR
351 /**
352 Creates the file name from file path and file name.
353 */
7c913512
FM
354 void Assign(const wxString& path, const wxString& name,
355 wxPathFormat format = wxPATH_NATIVE);
0b70c946 356
ca4bcd88
RR
357 /**
358 Creates the file name from path, name and extension.
359 */
7c913512
FM
360 void Assign(const wxString& path, const wxString& name,
361 const wxString& ext,
362 wxPathFormat format = wxPATH_NATIVE);
23324ae1
FM
363
364 /**
365 Makes this object refer to the current working directory on the specified
4cc4bfaf 366 volume (or current volume if @a volume is empty).
3c4f71cc 367
4cc4bfaf 368 @see GetCwd()
23324ae1 369 */
382f12e4 370 void AssignCwd(const wxString& volume = wxEmptyString);
23324ae1
FM
371
372 /**
0b70c946
FM
373 Sets this file name object to the given directory name.
374 The name and extension will be empty.
23324ae1
FM
375 */
376 void AssignDir(const wxString& dir,
377 wxPathFormat format = wxPATH_NATIVE);
378
379 /**
380 Sets this file name object to the home directory.
381 */
382 void AssignHomeDir();
383
384 /**
0b70c946
FM
385 The function calls CreateTempFileName() to create a temporary file
386 and sets this object to the name of the file.
a44f3b5a 387
0b70c946 388 If a temporary file couldn't be created, the object is put into
f95032ca
RR
389 an invalid state (see IsOk()).
390 */
391 void AssignTempFileName(const wxString& prefix);
392
393 /**
394 The function calls CreateTempFileName() to create a temporary
395 file name and open @a fileTemp with it.
396
397 If the file couldn't be opened, the object is put into
398 an invalid state (see IsOk()).
23324ae1 399 */
a44f3b5a 400 void AssignTempFileName(const wxString& prefix, wxFile* fileTemp);
f95032ca
RR
401
402 /**
403 The function calls CreateTempFileName() to create a temporary
404 file name and open @a fileTemp with it.
405
406 If the file couldn't be opened, the object is put into
407 an invalid state (see IsOk()).
408 */
a44f3b5a 409 void AssignTempFileName(const wxString& prefix, wxFFile* fileTemp);
23324ae1
FM
410
411 /**
412 Reset all components to default, uninitialized state.
413 */
414 void Clear();
415
416 /**
7c913512 417 Removes the extension from the file name resulting in a
23324ae1 418 file name with no trailing dot.
3c4f71cc 419
4cc4bfaf 420 @see SetExt(), SetEmptyExt()
23324ae1 421 */
2bd56258 422 void ClearExt();
23324ae1 423
7740f1c7 424
23324ae1 425 /**
0b70c946 426 Returns a temporary file name starting with the given @e prefix.
7740f1c7
VZ
427 If @a prefix is an absolute path and ends in a separator, the
428 temporary file is created in this directory; if it is an absolute
429 filepath or there is no separator, the temporary file is created in its
430 path, with the 'name' segment prepended to the temporary filename;
431 otherwise it is created in the default system directory for temporary
432 files or in the current directory.
0b70c946
FM
433
434 If the function succeeds, the temporary file is actually created.
7740f1c7
VZ
435 If @a fileTemp is not @NULL, this wxFile will be opened using the name of
436 the temporary file. Where possible this is done in an atomic way to ensure that
437 no race condition occurs between creating the temporary file name and opening
438 it, which might lead to a security compromise on multiuser systems.
439 If @a fileTemp is @NULL, the file is created but not opened.
23324ae1 440 Under Unix, the temporary file will have read and write permissions for the
7740f1c7 441 owner only, to minimize security problems.
3c4f71cc 442
7c913512 443 @param prefix
7740f1c7
VZ
444 Location to use for the temporary file name construction. If @a prefix
445 is a directory it must have a terminal separator
7c913512 446 @param fileTemp
7740f1c7 447 The file to open, or @NULL just to get the name
3c4f71cc 448
7740f1c7 449 @return The full temporary filepath, or an empty string on error.
23324ae1
FM
450 */
451 static wxString CreateTempFileName(const wxString& prefix,
4cc4bfaf 452 wxFile* fileTemp = NULL);
7740f1c7
VZ
453
454 /**
455 This is the same as CreateTempFileName(const wxString &prefix, wxFile *fileTemp)
456 but takes a wxFFile parameter instead of wxFile.
457 */
882678eb
FM
458 static wxString CreateTempFileName(const wxString& prefix,
459 wxFFile* fileTemp = NULL);
7740f1c7 460
23324ae1 461
23324ae1
FM
462 /**
463 Returns @true if the directory with this name exists.
996d3fe3
VZ
464
465 Notice that this function tests the directory part of this object,
466 i.e. the string returned by GetPath(), and not the full path returned
467 by GetFullPath().
468
469 @see FileExists(), Exists()
23324ae1 470 */
0b70c946
FM
471 bool DirExists() const;
472
ca4bcd88 473 /**
d38315df 474 Returns @true if the directory with name @a dir exists.
996d3fe3
VZ
475
476 @see FileExists(), Exists()
ca4bcd88 477 */
0b70c946 478 static bool DirExists(const wxString& dir);
23324ae1
FM
479
480 /**
481 Returns the object corresponding to the directory with the given name.
4cc4bfaf 482 The @a dir parameter may have trailing path separator or not.
23324ae1
FM
483 */
484 static wxFileName DirName(const wxString& dir,
485 wxPathFormat format = wxPATH_NATIVE);
486
996d3fe3
VZ
487 /**
488 Calls the static overload of this function with the full path of this
489 object.
490
491 @since 2.9.4
492 */
493 bool Exists() const;
494
495 /**
496 Returns @true if either a file or a directory or something else with
497 this name exists in the file system.
498
499 This method is equivalent to @code FileExists() || DirExists() @endcode
500 under most systems but under Unix it also returns true if the file
501 identifies a special file system object such as a device, a socket or a
502 FIFO.
503
504 @since 2.9.4
505
506 @see FileExists(), DirExists()
507 */
508 static bool Exists(const wxString& path);
509
23324ae1 510 /**
ca4bcd88 511 Returns @true if the file with this name exists.
3c4f71cc 512
996d3fe3 513 @see DirExists(), Exists()
23324ae1 514 */
0b70c946
FM
515 bool FileExists() const;
516
23324ae1 517 /**
d38315df 518 Returns @true if the file with name @a file exists.
3c4f71cc 519
996d3fe3 520 @see DirExists(), Exists()
23324ae1 521 */
0b70c946 522 static bool FileExists(const wxString& file);
23324ae1
FM
523
524 /**
525 Returns the file name object corresponding to the given @e file. This
526 function exists mainly for symmetry with DirName().
527 */
528 static wxFileName FileName(const wxString& file,
529 wxPathFormat format = wxPATH_NATIVE);
530
531 /**
0b70c946
FM
532 Retrieves the value of the current working directory on the specified volume.
533 If the volume is empty, the program's current working directory is returned for
534 the current volume.
3c4f71cc 535
d29a9a8a 536 @return The string containing the current working directory or an empty
0b70c946 537 string on error.
3c4f71cc 538
4cc4bfaf 539 @see AssignCwd()
23324ae1 540 */
0b70c946 541 static wxString GetCwd(const wxString& volume = wxEmptyString);
23324ae1
FM
542
543 /**
544 Returns the number of directories in the file name.
545 */
328f5751 546 size_t GetDirCount() const;
23324ae1
FM
547
548 /**
549 Returns the directories in string array form.
550 */
0b70c946 551 const wxArrayString& GetDirs() const;
23324ae1
FM
552
553 /**
554 Returns the file name extension.
555 */
328f5751 556 wxString GetExt() const;
23324ae1
FM
557
558 /**
0b70c946
FM
559 Returns the characters that can't be used in filenames and directory names
560 for the specified format.
23324ae1
FM
561 */
562 static wxString GetForbiddenChars(wxPathFormat format = wxPATH_NATIVE);
563
564 /**
565 Returns the canonical path format for this platform.
566 */
567 static wxPathFormat GetFormat(wxPathFormat format = wxPATH_NATIVE);
568
569 /**
570 Returns the full name (including extension but excluding directories).
571 */
328f5751 572 wxString GetFullName() const;
23324ae1
FM
573
574 /**
575 Returns the full path with name and extension.
576 */
328f5751 577 wxString GetFullPath(wxPathFormat format = wxPATH_NATIVE) const;
23324ae1
FM
578
579 /**
580 Returns the home directory.
581 */
582 static wxString GetHomeDir();
583
b2edb8f3 584 //@{
23324ae1 585 /**
b2edb8f3
VZ
586 Returns the representation of the file size in a human-readable form.
587
588 In the first version, the size of this file is used. In the second one,
589 the specified size @a bytes is used.
590
591 If the file size could not be retrieved or @a bytes is ::wxInvalidSize
592 or zero, the @c failmsg string is returned.
593
594 Otherwise the returned string is a floating-point number with @c
595 precision decimal digits followed by the abbreviation of the unit used.
596 By default the traditional, although incorrect, convention of using SI
597 units for multiples of 1024 is used, i.e. returned string will use
598 suffixes of B, KB, MB, GB, TB for bytes, kilobytes, megabytes,
599 gigabytes and terabytes respectively. With the IEC convention the names
e02edc0e 600 of the units are changed to B, KiB, MiB, GiB and TiB for bytes,
d13b34d3 601 kibibytes, mebibytes, gibibytes and tebibytes. Finally, with SI
b2edb8f3
VZ
602 convention the same B, KB, MB, GB and TB suffixes are used but in their
603 correct SI meaning, i.e. as multiples of 1000 and not 1024.
604
605 Support for the different size conventions is new in wxWidgets 2.9.1,
606 in previous versions only the traditional convention was implemented.
607 */
608 wxString
609 GetHumanReadableSize(const wxString& failmsg = _("Not available"),
610 int precision = 1,
2febffba 611 wxSizeConvention conv = wxSIZE_CONV_TRADITIONAL) const;
b2edb8f3
VZ
612
613 static wxString
614 GetHumanReadableSize(const wxULongLong& bytes,
615 const wxString& nullsize = _("Not available"),
616 int precision = 1,
2febffba 617 wxSizeConvention conv = wxSIZE_CONV_TRADITIONAL);
b2edb8f3 618 //@}
23324ae1
FM
619
620 /**
0b70c946 621 Return the long form of the path (returns identity on non-Windows platforms).
23324ae1 622 */
328f5751 623 wxString GetLongPath() const;
23324ae1
FM
624
625 /**
626 Returns the last time the file was last modified.
627 */
328f5751 628 wxDateTime GetModificationTime() const;
23324ae1
FM
629
630 /**
631 Returns the name part of the filename (without extension).
3c4f71cc 632
4cc4bfaf 633 @see GetFullName()
23324ae1 634 */
328f5751 635 wxString GetName() const;
23324ae1
FM
636
637 /**
35c2aa4f
VZ
638 Returns the path part of the filename (without the name or extension).
639
640 The possible flags values are:
3c4f71cc 641
eadd3970 642 - @b wxPATH_GET_VOLUME:
35c2aa4f
VZ
643 Return the path with the volume (does nothing for the filename formats
644 without volumes), otherwise the path without volume part is returned.
3c4f71cc 645
0b70c946 646 - @b wxPATH_GET_SEPARATOR:
35c2aa4f
VZ
647 Return the path with the trailing separator, if this flag is not given
648 there will be no separator at the end of the path.
649
0b70c946 650 - @b wxPATH_NO_SEPARATOR:
35c2aa4f
VZ
651 Don't include the trailing separator in the returned string. This is
652 the default (the value of this flag is 0) and exists only for symmetry
653 with wxPATH_GET_SEPARATOR.
76ba33d3
VS
654
655 @note If the path is a toplevel one (e.g. @c "/" on Unix or @c "C:\" on
656 Windows), then the returned path will contain trailing separator
657 even with @c wxPATH_NO_SEPARATOR.
23324ae1
FM
658 */
659 wxString GetPath(int flags = wxPATH_GET_VOLUME,
328f5751 660 wxPathFormat format = wxPATH_NATIVE) const;
23324ae1
FM
661
662 /**
0b70c946
FM
663 Returns the usually used path separator for this format.
664 For all formats but @c wxPATH_DOS there is only one path separator anyhow,
665 but for DOS there are two of them and the native one, i.e. the backslash
666 is returned by this method.
3c4f71cc 667
4cc4bfaf 668 @see GetPathSeparators()
23324ae1 669 */
920b92a3 670 static wxUniChar GetPathSeparator(wxPathFormat format = wxPATH_NATIVE);
23324ae1
FM
671
672 /**
0b70c946
FM
673 Returns the string containing all the path separators for this format.
674 For all formats but @c wxPATH_DOS this string contains only one character
675 but for DOS and Windows both @c '/' and @c '\' may be used as separators.
3c4f71cc 676
4cc4bfaf 677 @see GetPathSeparator()
23324ae1
FM
678 */
679 static wxString GetPathSeparators(wxPathFormat format = wxPATH_NATIVE);
680
681 /**
0b70c946
FM
682 Returns the string of characters which may terminate the path part.
683 This is the same as GetPathSeparators() except for VMS
23324ae1
FM
684 path format where ] is used at the end of the path part.
685 */
686 static wxString GetPathTerminators(wxPathFormat format = wxPATH_NATIVE);
687
688 /**
0b70c946
FM
689 Returns the path with the trailing separator, useful for appending the name
690 to the given path.
691
692 This is the same as calling
693 @code
694 GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR, format)
695 @endcode
23324ae1 696 */
328f5751 697 wxString GetPathWithSep(wxPathFormat format = wxPATH_NATIVE) const;
23324ae1
FM
698
699 /**
700 Return the short form of the path (returns identity on non-Windows platforms).
701 */
328f5751 702 wxString GetShortPath() const;
23324ae1 703
23324ae1 704 /**
ca4bcd88
RR
705 Returns the size of the file If the file does not exist or its size could
706 not be read (because e.g. the file is locked by another process) the returned
0b70c946 707 value is ::wxInvalidSize.
23324ae1 708 */
adaaa686 709 wxULongLong GetSize() const;
0b70c946 710
ca4bcd88
RR
711 /**
712 Returns the size of the file If the file does not exist or its size could
713 not be read (because e.g. the file is locked by another process) the returned
0b70c946 714 value is ::wxInvalidSize.
ca4bcd88 715 */
882678eb 716 static wxULongLong GetSize(const wxString& filename);
23324ae1
FM
717
718 /**
719 Returns the directory used for temporary files.
720 */
721 static wxString GetTempDir();
722
723 /**
0b70c946
FM
724 Returns the last access, last modification and creation times.
725 The last access time is updated whenever the file is read or written
726 (or executed in the case of Windows), last modification time is only
727 changed when the file is written to.
728 Finally, the creation time is indeed the time when the file was created
23324ae1
FM
729 under Windows and the inode change time under Unix (as it is impossible to
730 retrieve the real file creation time there anyhow) which can also be changed
731 by many operations after the file creation.
0b70c946 732
23324ae1 733 If no filename or extension is specified in this instance of wxFileName
0b70c946
FM
734 (and therefore IsDir() returns @true) then this function will return the
735 directory times of the path specified by GetPath(), otherwise the file
736 times of the file specified by GetFullPath().
737 Any of the pointers may be @NULL if the corresponding time is not needed.
3c4f71cc 738
d29a9a8a 739 @return @true on success, @false if we failed to retrieve the times.
23324ae1
FM
740 */
741 bool GetTimes(wxDateTime* dtAccess, wxDateTime* dtMod,
328f5751 742 wxDateTime* dtCreate) const;
23324ae1
FM
743
744 /**
745 Returns the string containing the volume for this file name, empty if it
0b70c946
FM
746 doesn't have one or if the file system doesn't support volumes at all
747 (for example, Unix).
23324ae1 748 */
328f5751 749 wxString GetVolume() const;
23324ae1
FM
750
751 /**
752 Returns the string separating the volume from the path for this format.
753 */
754 static wxString GetVolumeSeparator(wxPathFormat format = wxPATH_NATIVE);
755
35c2aa4f
VZ
756 /**
757 This function builds a volume path string, for example "C:\\".
758
759 Implemented for the platforms which use drive letters, i.e. DOS, MSW
760 and OS/2 only.
761
762 @since 2.9.0
763
764 @param drive
0b70c946 765 The drive letter, 'A' through 'Z' or 'a' through 'z'.
35c2aa4f
VZ
766
767 @param flags
0b70c946
FM
768 @c wxPATH_NO_SEPARATOR or @c wxPATH_GET_SEPARATOR to omit or include
769 the trailing path separator, the default is to include it.
35c2aa4f
VZ
770
771 @return Volume path string.
772 */
773 static wxString GetVolumeString(char drive, int flags = wxPATH_GET_SEPARATOR);
774
23324ae1
FM
775 /**
776 Returns @true if an extension is present.
777 */
328f5751 778 bool HasExt() const;
23324ae1
FM
779
780 /**
781 Returns @true if a name is present.
782 */
328f5751 783 bool HasName() const;
23324ae1
FM
784
785 /**
786 Returns @true if a volume specifier is present.
787 */
328f5751 788 bool HasVolume() const;
23324ae1
FM
789
790 /**
791 Inserts a directory component before the zero-based position in the directory
792 list. Please see AppendDir() for important notes.
793 */
794 void InsertDir(size_t before, const wxString& dir);
795
796 /**
797 Returns @true if this filename is absolute.
798 */
2bd56258 799 bool IsAbsolute(wxPathFormat format = wxPATH_NATIVE) const;
23324ae1
FM
800
801 /**
802 Returns @true if the file names of this type are case-sensitive.
803 */
804 static bool IsCaseSensitive(wxPathFormat format = wxPATH_NATIVE);
805
806 /**
807 Returns @true if this object represents a directory, @false otherwise
0b70c946
FM
808 (i.e. if it is a file).
809
810 Note that this method doesn't test whether the directory or file really
811 exists, you should use DirExists() or FileExists() for this.
23324ae1 812 */
328f5751 813 bool IsDir() const;
23324ae1 814
23324ae1 815 /**
2bd56258
RR
816 Returns @true if the directory component of this instance is an existing
817 directory and this process has read permissions on it. Read permissions
818 on a directory mean that you can list the directory contents but it
23324ae1
FM
819 doesn't imply that you have read permissions on the files contained.
820 */
2bd56258 821 bool IsDirReadable() const;
0b70c946 822
2bd56258
RR
823 /**
824 Returns @true if the given @e dir is an existing directory and this process
825 has read permissions on it. Read permissions on a directory mean that you
826 can list the directory contents but it doesn't imply that you have read
827 permissions on the files contained.
828 */
829 static bool IsDirReadable(const wxString& dir);
23324ae1 830
23324ae1 831 /**
2bd56258 832 Returns @true if the directory component of this instance
23324ae1
FM
833 is an existing directory and this process has write permissions on it.
834 Write permissions on a directory mean that you can create new files in the
835 directory.
836 */
2bd56258 837 bool IsDirWritable() const;
0b70c946 838
2bd56258 839 /**
0b70c946
FM
840 Returns @true if the given @a dir is an existing directory and this
841 process has write permissions on it.
2bd56258
RR
842 Write permissions on a directory mean that you can create new files in the
843 directory.
844 */
845 static bool IsDirWritable(const wxString& dir);
23324ae1 846
23324ae1
FM
847 /**
848 Returns @true if a file with this name exists and if this process has execute
849 permissions on it.
850 */
2bd56258 851 bool IsFileExecutable() const;
0b70c946 852
2bd56258
RR
853 /**
854 Returns @true if a file with this name exists and if this process has execute
855 permissions on it.
856 */
857 static bool IsFileExecutable(const wxString& file);
23324ae1 858
23324ae1
FM
859 /**
860 Returns @true if a file with this name exists and if this process has read
861 permissions on it.
862 */
2bd56258 863 bool IsFileReadable() const;
0b70c946 864
2bd56258
RR
865 /**
866 Returns @true if a file with this name exists and if this process has read
867 permissions on it.
868 */
869 static bool IsFileReadable(const wxString& file);
23324ae1 870
23324ae1
FM
871 /**
872 Returns @true if a file with this name exists and if this process has write
873 permissions on it.
874 */
2bd56258 875 bool IsFileWritable() const;
0b70c946 876
2bd56258
RR
877 /**
878 Returns @true if a file with this name exists and if this process has write
879 permissions on it.
880 */
881 static bool IsFileWritable(const wxString& file);
23324ae1
FM
882
883 /**
0b70c946
FM
884 Returns @true if the filename is valid, @false if it is not initialized yet.
885 The assignment functions and Clear() may reset the object to the uninitialized,
23324ae1
FM
886 invalid state (the former only do it on failure).
887 */
328f5751 888 bool IsOk() const;
23324ae1
FM
889
890 /**
891 Returns @true if the char is a path separator for this format.
892 */
893 static bool IsPathSeparator(wxChar ch,
894 wxPathFormat format = wxPATH_NATIVE);
895
e01a788e
VZ
896 /**
897 Returns @true if the volume part of the path is a unique volume name.
898
899 This function will always return @false if the path format is not
900 wxPATH_DOS.
901
902 Unique volume names are Windows volume identifiers which remain the same
903 regardless of where the volume is actually mounted. Example of a path
904 using a volume name could be
905 @code
906 \\?\Volume{8089d7d7-d0ac-11db-9dd0-806d6172696f}\Program Files\setup.exe
907 @endcode
908
909 @since 2.9.1
910 */
911 static bool IsMSWUniqueVolumeNamePath(const wxString& path,
912 wxPathFormat format = wxPATH_NATIVE);
913
23324ae1
FM
914 /**
915 Returns @true if this filename is not absolute.
916 */
2bd56258 917 bool IsRelative(wxPathFormat format = wxPATH_NATIVE) const;
23324ae1
FM
918
919 /**
920 On Mac OS, gets the common type and creator for the given extension.
ccca2121
VZ
921
922 @onlyfor{wxosx}
23324ae1
FM
923 */
924 static bool MacFindDefaultTypeAndCreator(const wxString& ext,
0b70c946
FM
925 wxUint32* type,
926 wxUint32* creator);
23324ae1
FM
927
928 /**
0b70c946
FM
929 On Mac OS, registers application defined extensions and their default type
930 and creator.
ccca2121
VZ
931
932 @onlyfor{wxosx}
23324ae1
FM
933 */
934 static void MacRegisterDefaultTypeAndCreator(const wxString& ext,
0b70c946
FM
935 wxUint32 type,
936 wxUint32 creator);
23324ae1
FM
937
938 /**
0b70c946
FM
939 On Mac OS, looks up the appropriate type and creator from the registration
940 and then sets it.
ccca2121
VZ
941
942 @onlyfor{wxosx}
23324ae1
FM
943 */
944 bool MacSetDefaultTypeAndCreator();
945
946 /**
0b70c946
FM
947 Make the file name absolute.
948 This is a shortcut for
949 @code
950 wxFileName::Normalize(wxPATH_NORM_DOTS | wxPATH_NORM_ABSOLUTE |
951 wxPATH_NORM_TILDE, cwd, format)
952 @endcode
3c4f71cc 953
4cc4bfaf 954 @see MakeRelativeTo(), Normalize(), IsAbsolute()
23324ae1
FM
955 */
956 bool MakeAbsolute(const wxString& cwd = wxEmptyString,
957 wxPathFormat format = wxPATH_NATIVE);
958
959 /**
7c913512 960 This function tries to put this file name in a form relative to
0b70c946
FM
961 @a pathBase.
962 In other words, it returns the file name which should be used to access
963 this file if the current directory were pathBase.
3c4f71cc 964
76e9224e 965 @param pathBase
0b70c946 966 The directory to use as root, current directory is used by default
7c913512 967 @param format
0b70c946 968 The file name format, native by default
3c4f71cc 969
d29a9a8a 970 @return @true if the file name has been changed, @false if we failed to do
0b70c946
FM
971 anything with it (currently this only happens if the file name
972 is on a volume different from the volume specified by @a pathBase).
3c4f71cc 973
4cc4bfaf 974 @see Normalize()
23324ae1
FM
975 */
976 bool MakeRelativeTo(const wxString& pathBase = wxEmptyString,
977 wxPathFormat format = wxPATH_NATIVE);
978
23324ae1 979 /**
ca4bcd88 980 Creates a directory.
0b70c946
FM
981
982 @param perm
f41d6c8c 983 The permissions for the newly created directory.
b91c4601 984 See the ::wxPosixPermissions enumeration for more info.
ca4bcd88 985 @param flags
0b70c946
FM
986 If the flags contain @c wxPATH_MKDIR_FULL flag, try to create each
987 directory in the path and also don't return an error if the target
988 directory already exists.
ca4bcd88
RR
989
990 @return Returns @true if the directory was successfully created, @false
0b70c946 991 otherwise.
ca4bcd88 992 */
89391a4e 993 bool Mkdir(int perm = wxS_DIR_DEFAULT, int flags = 0) const;
0b70c946 994
ca4bcd88
RR
995 /**
996 Creates a directory.
0b70c946 997
7c913512 998 @param dir
f41d6c8c 999 The directory to create
76e9224e 1000 @param perm
f41d6c8c 1001 The permissions for the newly created directory.
b91c4601 1002 See the ::wxPosixPermissions enumeration for more info.
7c913512 1003 @param flags
f41d6c8c 1004 If the flags contain @c wxPATH_MKDIR_FULL flag, try to create each
0b70c946
FM
1005 directory in the path and also don't return an error if the target
1006 directory already exists.
3c4f71cc 1007
d29a9a8a 1008 @return Returns @true if the directory was successfully created, @false
0b70c946 1009 otherwise.
23324ae1 1010 */
f41d6c8c 1011 static bool Mkdir(const wxString& dir, int perm = wxS_DIR_DEFAULT,
7c913512 1012 int flags = 0);
23324ae1
FM
1013
1014 /**
fcf56ee4
VZ
1015 Normalize the path.
1016
1017 With the default flags value, the path will be made absolute, without
1018 any ".." and "." and all environment variables will be expanded in it.
1019
1020 Notice that in some rare cases normalizing a valid path may result in
1021 an invalid wxFileName object. E.g. normalizing "./" path using
1022 wxPATH_NORM_DOTS but not wxPATH_NORM_ABSOLUTE will result in a
1023 completely empty and thus invalid object. As long as there is a non
1024 empty file name the result of normalization will be valid however.
3c4f71cc 1025
7c913512 1026 @param flags
4cc4bfaf 1027 The kind of normalization to do with the file name. It can be
992ff331 1028 any or-combination of the ::wxPathNormalize enumeration values.
4cc4bfaf
FM
1029 @param cwd
1030 If not empty, this directory will be used instead of current
0b70c946 1031 working directory in normalization (see @c wxPATH_NORM_ABSOLUTE).
7c913512 1032 @param format
4cc4bfaf 1033 The file name format to use when processing the paths, native by default.
3c4f71cc 1034
d29a9a8a 1035 @return @true if normalization was successfully or @false otherwise.
23324ae1
FM
1036 */
1037 bool Normalize(int flags = wxPATH_NORM_ALL,
1038 const wxString& cwd = wxEmptyString,
1039 wxPathFormat format = wxPATH_NATIVE);
1040
23324ae1 1041 /**
0b70c946
FM
1042 Prepends a directory to the file path.
1043 Please see AppendDir() for important notes.
23324ae1
FM
1044 */
1045 void PrependDir(const wxString& dir);
1046
1047 /**
1048 Removes the specified directory component from the path.
3c4f71cc 1049
4cc4bfaf 1050 @see GetDirCount()
23324ae1
FM
1051 */
1052 void RemoveDir(size_t pos);
1053
1054 /**
1055 Removes last directory component from the path.
1056 */
1057 void RemoveLastDir();
1058
395f3aa8
FM
1059 /**
1060 If the path contains the value of the environment variable named @a envname
1061 then this function replaces it with the string obtained from
1062 wxString::Format(replacementFmtString, value_of_envname_variable).
1063
1064 This function is useful to make the path shorter or to make it dependent
1065 from a certain environment variable.
1066 Normalize() with @c wxPATH_NORM_ENV_VARS can perform the opposite of this
1067 function (depending on the value of @a replacementFmtString).
1068
1069 The name and extension of this filename are not modified.
1070
1071 Example:
1072 @code
1073 wxFileName fn("/usr/openwin/lib/someFile");
1074 fn.ReplaceEnvVariable("OPENWINHOME");
1075 // now fn.GetFullPath() == "$OPENWINHOME/lib/someFile"
1076 @endcode
1077
1078 @since 2.9.0
1079
1080 @return @true if the operation was successful (which doesn't mean
1081 that something was actually replaced, just that ::wxGetEnv
1082 didn't fail).
1083 */
1084 bool ReplaceEnvVariable(const wxString& envname,
1085 const wxString& replacementFmtString = "$%s",
1086 wxPathFormat format = wxPATH_NATIVE);
1087
1088 /**
1089 Replaces, if present in the path, the home directory for the given user
1090 (see ::wxGetHomeDir) with a tilde (~).
1091
1092 Normalize() with @c wxPATH_NORM_TILDE performs the opposite of this
1093 function.
1094
1095 The name and extension of this filename are not modified.
1096
1097 @since 2.9.0
1098
1099 @return @true if the operation was successful (which doesn't mean
1100 that something was actually replaced, just that ::wxGetHomeDir
1101 didn't fail).
1102 */
1103 bool ReplaceHomeDir(wxPathFormat format = wxPATH_NATIVE);
1104
1105
23324ae1
FM
1106 /**
1107 Deletes the specified directory from the file system.
110c5094
VZ
1108
1109 @param flags
1110 Can contain one of wxPATH_RMDIR_FULL or wxPATH_RMDIR_RECURSIVE. By
1111 default contains neither so the directory will not be removed
1112 unless it is empty.
1113
1114 @return Returns @true if the directory was successfully deleted, @false
1115 otherwise.
23324ae1 1116 */
89391a4e 1117 bool Rmdir(int flags = 0) const;
0b70c946 1118
2bd56258
RR
1119 /**
1120 Deletes the specified directory from the file system.
110c5094
VZ
1121
1122 @param dir
1123 The directory to delete
1124 @param flags
1125 Can contain one of wxPATH_RMDIR_FULL or wxPATH_RMDIR_RECURSIVE. By
1126 default contains neither so the directory will not be removed
1127 unless it is empty.
1128
1129 @return Returns @true if the directory was successfully deleted, @false
1130 otherwise.
2bd56258 1131 */
110c5094 1132 static bool Rmdir(const wxString& dir, int flags = 0);
23324ae1
FM
1133
1134 /**
1135 Compares the filename using the rules of this platform.
1136 */
1137 bool SameAs(const wxFileName& filepath,
328f5751 1138 wxPathFormat format = wxPATH_NATIVE) const;
23324ae1 1139
23324ae1
FM
1140 /**
1141 Changes the current working directory.
1142 */
d9e80dce 1143 bool SetCwd() const;
0b70c946 1144
2bd56258
RR
1145 /**
1146 Changes the current working directory.
1147 */
7c913512 1148 static bool SetCwd(const wxString& cwd);
23324ae1
FM
1149
1150 /**
7c913512
FM
1151 Sets the extension of the file name to be an empty extension.
1152 This is different from having no extension at all as the file
23324ae1 1153 name will have a trailing dot after a call to this method.
3c4f71cc 1154
4cc4bfaf 1155 @see SetExt(), ClearExt()
23324ae1
FM
1156 */
1157 void SetEmptyExt();
1158
1159 /**
0b70c946
FM
1160 Sets the extension of the file name.
1161
1162 Setting an empty string as the extension will remove the extension
1163 resulting in a file name without a trailing dot, unlike a call to
23324ae1 1164 SetEmptyExt().
3c4f71cc 1165
4cc4bfaf 1166 @see SetEmptyExt(), ClearExt()
23324ae1
FM
1167 */
1168 void SetExt(const wxString& ext);
1169
1170 /**
1171 The full name is the file name and extension (but without the path).
1172 */
1173 void SetFullName(const wxString& fullname);
1174
1175 /**
1176 Sets the name part (without extension).
3c4f71cc 1177
4cc4bfaf 1178 @see SetFullName()
23324ae1
FM
1179 */
1180 void SetName(const wxString& name);
1181
cb755cb7 1182 /**
824216af 1183 Sets the path.
cb755cb7 1184
824216af
VZ
1185 The @a path argument includes both the path and the volume, if
1186 supported by @a format.
1187
1188 Calling this function doesn't affect the name and extension components,
1189 to change them as well you can use Assign() or just an assignment
1190 operator.
cb755cb7
VZ
1191
1192 @see GetPath()
1193 */
1194 void SetPath(const wxString& path, wxPathFormat format = wxPATH_NATIVE);
1195
23324ae1
FM
1196 /**
1197 Sets the file creation and last access/modification times (any of the pointers
1198 may be @NULL).
1199 */
1200 bool SetTimes(const wxDateTime* dtAccess,
1201 const wxDateTime* dtMod,
d9e80dce 1202 const wxDateTime* dtCreate) const;
23324ae1
FM
1203
1204 /**
1205 Sets the volume specifier.
1206 */
1207 void SetVolume(const wxString& volume);
1208
1209 //@{
1210 /**
1211 This function splits a full file name into components: the volume (with the
1212 first version) path (including the volume in the second version), the base name
0b70c946
FM
1213 and the extension.
1214
1215 Any of the output parameters (@e volume, @e path, @a name or @e ext) may
1216 be @NULL if you are not interested in the value of a particular component.
1217 Also, @a fullpath may be empty on entry.
4cc4bfaf
FM
1218 On return, @a path contains the file path (without the trailing separator),
1219 @a name contains the file name and @a ext contains the file extension
23324ae1
FM
1220 without leading dot. All three of them may be empty if the corresponding
1221 component is. The old contents of the strings pointed to by these parameters
1222 will be overwritten in any case (if the pointers are not @NULL).
0b70c946 1223
cdbcf4c2 1224 Note that for a filename "foo." the extension is present, as indicated by the
7c913512 1225 trailing dot, but empty. If you need to cope with such cases, you should use
4cc4bfaf 1226 @a hasExt instead of relying on testing whether @a ext is empty or not.
23324ae1 1227 */
882678eb
FM
1228 static void SplitPath(const wxString& fullpath,
1229 wxString* volume,
23324ae1
FM
1230 wxString* path,
1231 wxString* name,
1232 wxString* ext,
882678eb 1233 bool* hasExt = NULL,
23324ae1 1234 wxPathFormat format = wxPATH_NATIVE);
7c913512
FM
1235 static void SplitPath(const wxString& fullpath,
1236 wxString* volume,
1237 wxString* path,
1238 wxString* name,
1239 wxString* ext,
882678eb 1240 wxPathFormat format);
7c913512
FM
1241 static void SplitPath(const wxString& fullpath,
1242 wxString* path,
1243 wxString* name,
1244 wxString* ext,
1245 wxPathFormat format = wxPATH_NATIVE);
23324ae1
FM
1246 //@}
1247
1248 /**
4cc4bfaf 1249 Splits the given @a fullpath into the volume part (which may be empty) and
23324ae1 1250 the pure path part, not containing any volume.
3c4f71cc 1251
4cc4bfaf 1252 @see SplitPath()
23324ae1
FM
1253 */
1254 static void SplitVolume(const wxString& fullpath,
1255 wxString* volume,
1256 wxString* path,
1257 wxPathFormat format = wxPATH_NATIVE);
1258
181dd701
VZ
1259
1260 /**
1261 Strip the file extension.
1262
1263 This function does more than just removing everything after the last
1264 period from the string, for example it will return the string ".vimrc"
1265 unchanged because the part after the period is not an extension but the
1266 file name in this case. You can use wxString::BeforeLast() to really
1267 get just the part before the last period (but notice that that function
1268 returns empty string if period is not present at all unlike this
1269 function which returns the @a fullname unchanged in this case).
1270
1271 @param fullname
1272 File path including name and, optionally, extension.
1273
1274 @return
1275 File path without extension
1276
1277 @since 2.9.0
1278 */
1279 static wxString StripExtension(const wxString& fullname);
1280
23324ae1
FM
1281 /**
1282 Sets the access and modification times to the current moment.
1283 */
d9e80dce 1284 bool Touch() const;
23324ae1 1285
23324ae1
FM
1286 /**
1287 Returns @true if the filenames are different. The string @e filenames
1288 is interpreted as a path in the native filename format.
1289 */
0b70c946
FM
1290 bool operator!=(const wxFileName& filename) const;
1291
2bd56258
RR
1292 /**
1293 Returns @true if the filenames are different. The string @e filenames
1294 is interpreted as a path in the native filename format.
1295 */
0b70c946 1296 bool operator!=(const wxString& filename) const;
23324ae1 1297
23324ae1 1298 /**
0b70c946
FM
1299 Returns @true if the filenames are equal. The string @e filenames is
1300 interpreted as a path in the native filename format.
2bd56258 1301 */
0b70c946 1302 bool operator==(const wxFileName& filename) const;
23324ae1 1303
23324ae1
FM
1304 /**
1305 Returns @true if the filenames are equal. The string @e filenames is
1306 interpreted as a path in the native filename format.
1307 */
0b70c946
FM
1308 bool operator==(const wxString& filename) const;
1309
2bd56258 1310 /**
0b70c946
FM
1311 Assigns the new value to this filename object.
1312 */
1313 wxFileName& operator=(const wxFileName& filename);
1314
1315 /**
1316 Assigns the new value to this filename object.
2bd56258 1317 */
0b70c946 1318 wxFileName& operator=(const wxString& filename);
23324ae1 1319};