]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: filename.h | |
3 | // Purpose: interface of wxFileName | |
4 | // Author: wxWidgets team | |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows licence | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | ||
10 | /** | |
11 | The various values for the path format: this mainly affects the path | |
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 | */ | |
17 | enum 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 | ||
31 | /** | |
32 | Different conventions for human readable sizes. | |
33 | ||
34 | @see wxFileName::GetHumanReadableSize(). | |
35 | ||
36 | @since 2.9.1 | |
37 | */ | |
38 | enum wxSizeConvention | |
39 | { | |
40 | /// 1024 bytes = 1KB. | |
41 | wxSIZE_CONV_TRADITIONAL, | |
42 | ||
43 | /// 1024 bytes = 1KiB. | |
44 | wxSIZE_CONV_IEC, | |
45 | ||
46 | /// 1000 bytes = 1KB. | |
47 | wxSIZE_CONV_SI | |
48 | }; | |
49 | ||
50 | ||
51 | /** | |
52 | The kind of normalization to do with the file name: these values can be | |
53 | or'd together to perform several operations at once. | |
54 | See wxFileName::Normalize() for more info. | |
55 | */ | |
56 | enum wxPathNormalize | |
57 | { | |
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 | ||
64 | wxPATH_NORM_DOTS = 0x0002, //!< Squeeze all @c ".." and @c ".". | |
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. | |
72 | wxPATH_NORM_ALL = 0x00ff & ~wxPATH_NORM_CASE | |
73 | }; | |
74 | ||
75 | /** | |
76 | Flags for wxFileName::Rmdir(). | |
77 | */ | |
78 | enum | |
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 | ||
93 | /** | |
94 | The return value of wxFileName::GetSize() in case of error. | |
95 | */ | |
96 | wxULongLong wxInvalidSize; | |
97 | ||
98 | ||
99 | /** | |
100 | @class wxFileName | |
101 | ||
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). | |
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. | |
111 | ||
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: | |
115 | ||
116 | @code | |
117 | wxFileName dirname( "C:\mydir", "" ); | |
118 | MyMethod( dirname.GetPath() ); | |
119 | @endcode | |
120 | ||
121 | The same can be done using the static method wxFileName::DirName(): | |
122 | ||
123 | @code | |
124 | wxFileName dirname = wxFileName::DirName( "C:\mydir" ); | |
125 | MyMethod( dirname.GetPath() ); | |
126 | @endcode | |
127 | ||
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(). | |
131 | ||
132 | If it is not known whether a string contains a directory name or a complete | |
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: | |
137 | ||
138 | @code | |
139 | wxString user_input; | |
140 | // get input from user | |
141 | ||
142 | wxFileName fname; | |
143 | if (wxDirExists(user_input)) | |
144 | fname.AssignDir( user_input ); | |
145 | else | |
146 | fname.Assign( user_input ); | |
147 | @endcode | |
148 | ||
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() | |
197 | @li wxFileName::AssignTempFileName() | |
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() | |
266 | ||
267 | ||
268 | @library{wxbase} | |
269 | @category{file} | |
270 | */ | |
271 | class wxFileName | |
272 | { | |
273 | public: | |
274 | /** | |
275 | Default constructor. | |
276 | */ | |
277 | wxFileName(); | |
278 | ||
279 | /** | |
280 | Copy constructor. | |
281 | */ | |
282 | wxFileName(const wxFileName& filename); | |
283 | ||
284 | /** | |
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. | |
290 | */ | |
291 | wxFileName(const wxString& fullpath, | |
292 | wxPathFormat format = wxPATH_NATIVE); | |
293 | ||
294 | /** | |
295 | Constructor a directory name and file name. | |
296 | */ | |
297 | wxFileName(const wxString& path, const wxString& name, | |
298 | wxPathFormat format = wxPATH_NATIVE); | |
299 | ||
300 | /** | |
301 | Constructor from a directory name, base file name and extension. | |
302 | */ | |
303 | wxFileName(const wxString& path, const wxString& name, | |
304 | const wxString& ext, | |
305 | wxPathFormat format = wxPATH_NATIVE); | |
306 | ||
307 | /** | |
308 | Constructor from a volume name, a directory name, base file name and extension. | |
309 | */ | |
310 | wxFileName(const wxString& volume, const wxString& path, | |
311 | const wxString& name, | |
312 | const wxString& ext, | |
313 | wxPathFormat format = wxPATH_NATIVE); | |
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 | ||
323 | /** | |
324 | Creates the file name from another filename object. | |
325 | */ | |
326 | void Assign(const wxFileName& filepath); | |
327 | ||
328 | /** | |
329 | Creates the file name from a full file name with a path. | |
330 | */ | |
331 | void Assign(const wxString& fullpath, | |
332 | wxPathFormat format = wxPATH_NATIVE); | |
333 | ||
334 | /** | |
335 | Creates the file name from volume, path, name and extension. | |
336 | */ | |
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); | |
342 | ||
343 | /** | |
344 | Creates the file name from volume, path, name and extension. | |
345 | */ | |
346 | void Assign(const wxString& volume, const wxString& path, | |
347 | const wxString& name, | |
348 | const wxString& ext, | |
349 | wxPathFormat format = wxPATH_NATIVE); | |
350 | ||
351 | /** | |
352 | Creates the file name from file path and file name. | |
353 | */ | |
354 | void Assign(const wxString& path, const wxString& name, | |
355 | wxPathFormat format = wxPATH_NATIVE); | |
356 | ||
357 | /** | |
358 | Creates the file name from path, name and extension. | |
359 | */ | |
360 | void Assign(const wxString& path, const wxString& name, | |
361 | const wxString& ext, | |
362 | wxPathFormat format = wxPATH_NATIVE); | |
363 | ||
364 | /** | |
365 | Makes this object refer to the current working directory on the specified | |
366 | volume (or current volume if @a volume is empty). | |
367 | ||
368 | @see GetCwd() | |
369 | */ | |
370 | void AssignCwd(const wxString& volume = wxEmptyString); | |
371 | ||
372 | /** | |
373 | Sets this file name object to the given directory name. | |
374 | The name and extension will be empty. | |
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 | /** | |
385 | The function calls CreateTempFileName() to create a temporary file | |
386 | and sets this object to the name of the file. | |
387 | ||
388 | If a temporary file couldn't be created, the object is put into | |
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()). | |
399 | */ | |
400 | void AssignTempFileName(const wxString& prefix, wxFile* fileTemp); | |
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 | */ | |
409 | void AssignTempFileName(const wxString& prefix, wxFFile* fileTemp); | |
410 | ||
411 | /** | |
412 | Reset all components to default, uninitialized state. | |
413 | */ | |
414 | void Clear(); | |
415 | ||
416 | /** | |
417 | Removes the extension from the file name resulting in a | |
418 | file name with no trailing dot. | |
419 | ||
420 | @see SetExt(), SetEmptyExt() | |
421 | */ | |
422 | void ClearExt(); | |
423 | ||
424 | //@{ | |
425 | /** | |
426 | Returns a temporary file name starting with the given @e prefix. | |
427 | If the @a prefix is an absolute path, the temporary file is created in this | |
428 | directory, otherwise it is created in the default system directory for the | |
429 | temporary files or in the current directory. | |
430 | ||
431 | If the function succeeds, the temporary file is actually created. | |
432 | If @a fileTemp is not @NULL, this file will be opened using the name of | |
433 | the temporary file. When possible, this is done in an atomic way ensuring that | |
434 | no race condition occurs between the temporary file name generation and opening | |
435 | it which could often lead to security compromise on the multiuser systems. | |
436 | If @a fileTemp is @NULL, the file is only created, but not opened. | |
437 | Under Unix, the temporary file will have read and write permissions for the | |
438 | owner only to minimize the security problems. | |
439 | ||
440 | @param prefix | |
441 | Prefix to use for the temporary file name construction | |
442 | @param fileTemp | |
443 | The file to open or @NULL to just get the name | |
444 | ||
445 | @return The full temporary file name or an empty string on error. | |
446 | */ | |
447 | static wxString CreateTempFileName(const wxString& prefix, | |
448 | wxFile* fileTemp = NULL); | |
449 | static wxString CreateTempFileName(const wxString& prefix, | |
450 | wxFFile* fileTemp = NULL); | |
451 | //@} | |
452 | ||
453 | /** | |
454 | Returns @true if the directory with this name exists. | |
455 | */ | |
456 | bool DirExists() const; | |
457 | ||
458 | /** | |
459 | Returns @true if the directory with name @a dir exists. | |
460 | */ | |
461 | static bool DirExists(const wxString& dir); | |
462 | ||
463 | /** | |
464 | Returns the object corresponding to the directory with the given name. | |
465 | The @a dir parameter may have trailing path separator or not. | |
466 | */ | |
467 | static wxFileName DirName(const wxString& dir, | |
468 | wxPathFormat format = wxPATH_NATIVE); | |
469 | ||
470 | /** | |
471 | Returns @true if the file with this name exists. | |
472 | ||
473 | @see DirExists() | |
474 | */ | |
475 | bool FileExists() const; | |
476 | ||
477 | /** | |
478 | Returns @true if the file with name @a file exists. | |
479 | ||
480 | @see DirExists() | |
481 | */ | |
482 | static bool FileExists(const wxString& file); | |
483 | ||
484 | /** | |
485 | Returns the file name object corresponding to the given @e file. This | |
486 | function exists mainly for symmetry with DirName(). | |
487 | */ | |
488 | static wxFileName FileName(const wxString& file, | |
489 | wxPathFormat format = wxPATH_NATIVE); | |
490 | ||
491 | /** | |
492 | Retrieves the value of the current working directory on the specified volume. | |
493 | If the volume is empty, the program's current working directory is returned for | |
494 | the current volume. | |
495 | ||
496 | @return The string containing the current working directory or an empty | |
497 | string on error. | |
498 | ||
499 | @see AssignCwd() | |
500 | */ | |
501 | static wxString GetCwd(const wxString& volume = wxEmptyString); | |
502 | ||
503 | /** | |
504 | Returns the number of directories in the file name. | |
505 | */ | |
506 | size_t GetDirCount() const; | |
507 | ||
508 | /** | |
509 | Returns the directories in string array form. | |
510 | */ | |
511 | const wxArrayString& GetDirs() const; | |
512 | ||
513 | /** | |
514 | Returns the file name extension. | |
515 | */ | |
516 | wxString GetExt() const; | |
517 | ||
518 | /** | |
519 | Returns the characters that can't be used in filenames and directory names | |
520 | for the specified format. | |
521 | */ | |
522 | static wxString GetForbiddenChars(wxPathFormat format = wxPATH_NATIVE); | |
523 | ||
524 | /** | |
525 | Returns the canonical path format for this platform. | |
526 | */ | |
527 | static wxPathFormat GetFormat(wxPathFormat format = wxPATH_NATIVE); | |
528 | ||
529 | /** | |
530 | Returns the full name (including extension but excluding directories). | |
531 | */ | |
532 | wxString GetFullName() const; | |
533 | ||
534 | /** | |
535 | Returns the full path with name and extension. | |
536 | */ | |
537 | wxString GetFullPath(wxPathFormat format = wxPATH_NATIVE) const; | |
538 | ||
539 | /** | |
540 | Returns the home directory. | |
541 | */ | |
542 | static wxString GetHomeDir(); | |
543 | ||
544 | //@{ | |
545 | /** | |
546 | Returns the representation of the file size in a human-readable form. | |
547 | ||
548 | In the first version, the size of this file is used. In the second one, | |
549 | the specified size @a bytes is used. | |
550 | ||
551 | If the file size could not be retrieved or @a bytes is ::wxInvalidSize | |
552 | or zero, the @c failmsg string is returned. | |
553 | ||
554 | Otherwise the returned string is a floating-point number with @c | |
555 | precision decimal digits followed by the abbreviation of the unit used. | |
556 | By default the traditional, although incorrect, convention of using SI | |
557 | units for multiples of 1024 is used, i.e. returned string will use | |
558 | suffixes of B, KB, MB, GB, TB for bytes, kilobytes, megabytes, | |
559 | gigabytes and terabytes respectively. With the IEC convention the names | |
560 | of the units are changed to B, KiB, MiB, GiB and TiB for bytes, | |
561 | kibibytes, mebibytes, gibibytes and tebibytes. Finally, with SI | |
562 | convention the same B, KB, MB, GB and TB suffixes are used but in their | |
563 | correct SI meaning, i.e. as multiples of 1000 and not 1024. | |
564 | ||
565 | Support for the different size conventions is new in wxWidgets 2.9.1, | |
566 | in previous versions only the traditional convention was implemented. | |
567 | */ | |
568 | wxString | |
569 | GetHumanReadableSize(const wxString& failmsg = _("Not available"), | |
570 | int precision = 1, | |
571 | wxSizeConvention conv = wxSIZE_CONV_TRADITIONAL) const; | |
572 | ||
573 | static wxString | |
574 | GetHumanReadableSize(const wxULongLong& bytes, | |
575 | const wxString& nullsize = _("Not available"), | |
576 | int precision = 1, | |
577 | wxSizeConvention conv = wxSIZE_CONV_TRADITIONAL); | |
578 | //@} | |
579 | ||
580 | /** | |
581 | Return the long form of the path (returns identity on non-Windows platforms). | |
582 | */ | |
583 | wxString GetLongPath() const; | |
584 | ||
585 | /** | |
586 | Returns the last time the file was last modified. | |
587 | */ | |
588 | wxDateTime GetModificationTime() const; | |
589 | ||
590 | /** | |
591 | Returns the name part of the filename (without extension). | |
592 | ||
593 | @see GetFullName() | |
594 | */ | |
595 | wxString GetName() const; | |
596 | ||
597 | /** | |
598 | Returns the path part of the filename (without the name or extension). | |
599 | ||
600 | The possible flags values are: | |
601 | ||
602 | - @b wxPATH_GET_VOLUME: | |
603 | Return the path with the volume (does nothing for the filename formats | |
604 | without volumes), otherwise the path without volume part is returned. | |
605 | ||
606 | - @b wxPATH_GET_SEPARATOR: | |
607 | Return the path with the trailing separator, if this flag is not given | |
608 | there will be no separator at the end of the path. | |
609 | ||
610 | - @b wxPATH_NO_SEPARATOR: | |
611 | Don't include the trailing separator in the returned string. This is | |
612 | the default (the value of this flag is 0) and exists only for symmetry | |
613 | with wxPATH_GET_SEPARATOR. | |
614 | ||
615 | @note If the path is a toplevel one (e.g. @c "/" on Unix or @c "C:\" on | |
616 | Windows), then the returned path will contain trailing separator | |
617 | even with @c wxPATH_NO_SEPARATOR. | |
618 | */ | |
619 | wxString GetPath(int flags = wxPATH_GET_VOLUME, | |
620 | wxPathFormat format = wxPATH_NATIVE) const; | |
621 | ||
622 | /** | |
623 | Returns the usually used path separator for this format. | |
624 | For all formats but @c wxPATH_DOS there is only one path separator anyhow, | |
625 | but for DOS there are two of them and the native one, i.e. the backslash | |
626 | is returned by this method. | |
627 | ||
628 | @see GetPathSeparators() | |
629 | */ | |
630 | static wxUniChar GetPathSeparator(wxPathFormat format = wxPATH_NATIVE); | |
631 | ||
632 | /** | |
633 | Returns the string containing all the path separators for this format. | |
634 | For all formats but @c wxPATH_DOS this string contains only one character | |
635 | but for DOS and Windows both @c '/' and @c '\' may be used as separators. | |
636 | ||
637 | @see GetPathSeparator() | |
638 | */ | |
639 | static wxString GetPathSeparators(wxPathFormat format = wxPATH_NATIVE); | |
640 | ||
641 | /** | |
642 | Returns the string of characters which may terminate the path part. | |
643 | This is the same as GetPathSeparators() except for VMS | |
644 | path format where ] is used at the end of the path part. | |
645 | */ | |
646 | static wxString GetPathTerminators(wxPathFormat format = wxPATH_NATIVE); | |
647 | ||
648 | /** | |
649 | Returns the path with the trailing separator, useful for appending the name | |
650 | to the given path. | |
651 | ||
652 | This is the same as calling | |
653 | @code | |
654 | GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR, format) | |
655 | @endcode | |
656 | */ | |
657 | wxString GetPathWithSep(wxPathFormat format = wxPATH_NATIVE) const; | |
658 | ||
659 | /** | |
660 | Return the short form of the path (returns identity on non-Windows platforms). | |
661 | */ | |
662 | wxString GetShortPath() const; | |
663 | ||
664 | /** | |
665 | Returns the size of the file If the file does not exist or its size could | |
666 | not be read (because e.g. the file is locked by another process) the returned | |
667 | value is ::wxInvalidSize. | |
668 | */ | |
669 | wxULongLong GetSize() const; | |
670 | ||
671 | /** | |
672 | Returns the size of the file If the file does not exist or its size could | |
673 | not be read (because e.g. the file is locked by another process) the returned | |
674 | value is ::wxInvalidSize. | |
675 | */ | |
676 | static wxULongLong GetSize(const wxString& filename); | |
677 | ||
678 | /** | |
679 | Returns the directory used for temporary files. | |
680 | */ | |
681 | static wxString GetTempDir(); | |
682 | ||
683 | /** | |
684 | Returns the last access, last modification and creation times. | |
685 | The last access time is updated whenever the file is read or written | |
686 | (or executed in the case of Windows), last modification time is only | |
687 | changed when the file is written to. | |
688 | Finally, the creation time is indeed the time when the file was created | |
689 | under Windows and the inode change time under Unix (as it is impossible to | |
690 | retrieve the real file creation time there anyhow) which can also be changed | |
691 | by many operations after the file creation. | |
692 | ||
693 | If no filename or extension is specified in this instance of wxFileName | |
694 | (and therefore IsDir() returns @true) then this function will return the | |
695 | directory times of the path specified by GetPath(), otherwise the file | |
696 | times of the file specified by GetFullPath(). | |
697 | Any of the pointers may be @NULL if the corresponding time is not needed. | |
698 | ||
699 | @return @true on success, @false if we failed to retrieve the times. | |
700 | */ | |
701 | bool GetTimes(wxDateTime* dtAccess, wxDateTime* dtMod, | |
702 | wxDateTime* dtCreate) const; | |
703 | ||
704 | /** | |
705 | Returns the string containing the volume for this file name, empty if it | |
706 | doesn't have one or if the file system doesn't support volumes at all | |
707 | (for example, Unix). | |
708 | */ | |
709 | wxString GetVolume() const; | |
710 | ||
711 | /** | |
712 | Returns the string separating the volume from the path for this format. | |
713 | */ | |
714 | static wxString GetVolumeSeparator(wxPathFormat format = wxPATH_NATIVE); | |
715 | ||
716 | /** | |
717 | This function builds a volume path string, for example "C:\\". | |
718 | ||
719 | Implemented for the platforms which use drive letters, i.e. DOS, MSW | |
720 | and OS/2 only. | |
721 | ||
722 | @since 2.9.0 | |
723 | ||
724 | @param drive | |
725 | The drive letter, 'A' through 'Z' or 'a' through 'z'. | |
726 | ||
727 | @param flags | |
728 | @c wxPATH_NO_SEPARATOR or @c wxPATH_GET_SEPARATOR to omit or include | |
729 | the trailing path separator, the default is to include it. | |
730 | ||
731 | @return Volume path string. | |
732 | */ | |
733 | static wxString GetVolumeString(char drive, int flags = wxPATH_GET_SEPARATOR); | |
734 | ||
735 | /** | |
736 | Returns @true if an extension is present. | |
737 | */ | |
738 | bool HasExt() const; | |
739 | ||
740 | /** | |
741 | Returns @true if a name is present. | |
742 | */ | |
743 | bool HasName() const; | |
744 | ||
745 | /** | |
746 | Returns @true if a volume specifier is present. | |
747 | */ | |
748 | bool HasVolume() const; | |
749 | ||
750 | /** | |
751 | Inserts a directory component before the zero-based position in the directory | |
752 | list. Please see AppendDir() for important notes. | |
753 | */ | |
754 | void InsertDir(size_t before, const wxString& dir); | |
755 | ||
756 | /** | |
757 | Returns @true if this filename is absolute. | |
758 | */ | |
759 | bool IsAbsolute(wxPathFormat format = wxPATH_NATIVE) const; | |
760 | ||
761 | /** | |
762 | Returns @true if the file names of this type are case-sensitive. | |
763 | */ | |
764 | static bool IsCaseSensitive(wxPathFormat format = wxPATH_NATIVE); | |
765 | ||
766 | /** | |
767 | Returns @true if this object represents a directory, @false otherwise | |
768 | (i.e. if it is a file). | |
769 | ||
770 | Note that this method doesn't test whether the directory or file really | |
771 | exists, you should use DirExists() or FileExists() for this. | |
772 | */ | |
773 | bool IsDir() const; | |
774 | ||
775 | /** | |
776 | Returns @true if the directory component of this instance is an existing | |
777 | directory and this process has read permissions on it. Read permissions | |
778 | on a directory mean that you can list the directory contents but it | |
779 | doesn't imply that you have read permissions on the files contained. | |
780 | */ | |
781 | bool IsDirReadable() const; | |
782 | ||
783 | /** | |
784 | Returns @true if the given @e dir is an existing directory and this process | |
785 | has read permissions on it. Read permissions on a directory mean that you | |
786 | can list the directory contents but it doesn't imply that you have read | |
787 | permissions on the files contained. | |
788 | */ | |
789 | static bool IsDirReadable(const wxString& dir); | |
790 | ||
791 | /** | |
792 | Returns @true if the directory component of this instance | |
793 | is an existing directory and this process has write permissions on it. | |
794 | Write permissions on a directory mean that you can create new files in the | |
795 | directory. | |
796 | */ | |
797 | bool IsDirWritable() const; | |
798 | ||
799 | /** | |
800 | Returns @true if the given @a dir is an existing directory and this | |
801 | process has write permissions on it. | |
802 | Write permissions on a directory mean that you can create new files in the | |
803 | directory. | |
804 | */ | |
805 | static bool IsDirWritable(const wxString& dir); | |
806 | ||
807 | /** | |
808 | Returns @true if a file with this name exists and if this process has execute | |
809 | permissions on it. | |
810 | */ | |
811 | bool IsFileExecutable() const; | |
812 | ||
813 | /** | |
814 | Returns @true if a file with this name exists and if this process has execute | |
815 | permissions on it. | |
816 | */ | |
817 | static bool IsFileExecutable(const wxString& file); | |
818 | ||
819 | /** | |
820 | Returns @true if a file with this name exists and if this process has read | |
821 | permissions on it. | |
822 | */ | |
823 | bool IsFileReadable() const; | |
824 | ||
825 | /** | |
826 | Returns @true if a file with this name exists and if this process has read | |
827 | permissions on it. | |
828 | */ | |
829 | static bool IsFileReadable(const wxString& file); | |
830 | ||
831 | /** | |
832 | Returns @true if a file with this name exists and if this process has write | |
833 | permissions on it. | |
834 | */ | |
835 | bool IsFileWritable() const; | |
836 | ||
837 | /** | |
838 | Returns @true if a file with this name exists and if this process has write | |
839 | permissions on it. | |
840 | */ | |
841 | static bool IsFileWritable(const wxString& file); | |
842 | ||
843 | /** | |
844 | Returns @true if the filename is valid, @false if it is not initialized yet. | |
845 | The assignment functions and Clear() may reset the object to the uninitialized, | |
846 | invalid state (the former only do it on failure). | |
847 | */ | |
848 | bool IsOk() const; | |
849 | ||
850 | /** | |
851 | Returns @true if the char is a path separator for this format. | |
852 | */ | |
853 | static bool IsPathSeparator(wxChar ch, | |
854 | wxPathFormat format = wxPATH_NATIVE); | |
855 | ||
856 | /** | |
857 | Returns @true if the volume part of the path is a unique volume name. | |
858 | ||
859 | This function will always return @false if the path format is not | |
860 | wxPATH_DOS. | |
861 | ||
862 | Unique volume names are Windows volume identifiers which remain the same | |
863 | regardless of where the volume is actually mounted. Example of a path | |
864 | using a volume name could be | |
865 | @code | |
866 | \\?\Volume{8089d7d7-d0ac-11db-9dd0-806d6172696f}\Program Files\setup.exe | |
867 | @endcode | |
868 | ||
869 | @since 2.9.1 | |
870 | */ | |
871 | static bool IsMSWUniqueVolumeNamePath(const wxString& path, | |
872 | wxPathFormat format = wxPATH_NATIVE); | |
873 | ||
874 | /** | |
875 | Returns @true if this filename is not absolute. | |
876 | */ | |
877 | bool IsRelative(wxPathFormat format = wxPATH_NATIVE) const; | |
878 | ||
879 | /** | |
880 | On Mac OS, gets the common type and creator for the given extension. | |
881 | */ | |
882 | static bool MacFindDefaultTypeAndCreator(const wxString& ext, | |
883 | wxUint32* type, | |
884 | wxUint32* creator); | |
885 | ||
886 | /** | |
887 | On Mac OS, registers application defined extensions and their default type | |
888 | and creator. | |
889 | */ | |
890 | static void MacRegisterDefaultTypeAndCreator(const wxString& ext, | |
891 | wxUint32 type, | |
892 | wxUint32 creator); | |
893 | ||
894 | /** | |
895 | On Mac OS, looks up the appropriate type and creator from the registration | |
896 | and then sets it. | |
897 | */ | |
898 | bool MacSetDefaultTypeAndCreator(); | |
899 | ||
900 | /** | |
901 | Make the file name absolute. | |
902 | This is a shortcut for | |
903 | @code | |
904 | wxFileName::Normalize(wxPATH_NORM_DOTS | wxPATH_NORM_ABSOLUTE | | |
905 | wxPATH_NORM_TILDE, cwd, format) | |
906 | @endcode | |
907 | ||
908 | @see MakeRelativeTo(), Normalize(), IsAbsolute() | |
909 | */ | |
910 | bool MakeAbsolute(const wxString& cwd = wxEmptyString, | |
911 | wxPathFormat format = wxPATH_NATIVE); | |
912 | ||
913 | /** | |
914 | This function tries to put this file name in a form relative to | |
915 | @a pathBase. | |
916 | In other words, it returns the file name which should be used to access | |
917 | this file if the current directory were pathBase. | |
918 | ||
919 | @param pathBase | |
920 | The directory to use as root, current directory is used by default | |
921 | @param format | |
922 | The file name format, native by default | |
923 | ||
924 | @return @true if the file name has been changed, @false if we failed to do | |
925 | anything with it (currently this only happens if the file name | |
926 | is on a volume different from the volume specified by @a pathBase). | |
927 | ||
928 | @see Normalize() | |
929 | */ | |
930 | bool MakeRelativeTo(const wxString& pathBase = wxEmptyString, | |
931 | wxPathFormat format = wxPATH_NATIVE); | |
932 | ||
933 | /** | |
934 | Creates a directory. | |
935 | ||
936 | @param perm | |
937 | The permissions for the newly created directory. | |
938 | See the ::wxPosixPermissions enumeration for more info. | |
939 | @param flags | |
940 | If the flags contain @c wxPATH_MKDIR_FULL flag, try to create each | |
941 | directory in the path and also don't return an error if the target | |
942 | directory already exists. | |
943 | ||
944 | @return Returns @true if the directory was successfully created, @false | |
945 | otherwise. | |
946 | */ | |
947 | bool Mkdir(int perm = wxS_DIR_DEFAULT, int flags = 0) const; | |
948 | ||
949 | /** | |
950 | Creates a directory. | |
951 | ||
952 | @param dir | |
953 | The directory to create | |
954 | @param perm | |
955 | The permissions for the newly created directory. | |
956 | See the ::wxPosixPermissions enumeration for more info. | |
957 | @param flags | |
958 | If the flags contain @c wxPATH_MKDIR_FULL flag, try to create each | |
959 | directory in the path and also don't return an error if the target | |
960 | directory already exists. | |
961 | ||
962 | @return Returns @true if the directory was successfully created, @false | |
963 | otherwise. | |
964 | */ | |
965 | static bool Mkdir(const wxString& dir, int perm = wxS_DIR_DEFAULT, | |
966 | int flags = 0); | |
967 | ||
968 | /** | |
969 | Normalize the path. | |
970 | ||
971 | With the default flags value, the path will be made absolute, without | |
972 | any ".." and "." and all environment variables will be expanded in it. | |
973 | ||
974 | Notice that in some rare cases normalizing a valid path may result in | |
975 | an invalid wxFileName object. E.g. normalizing "./" path using | |
976 | wxPATH_NORM_DOTS but not wxPATH_NORM_ABSOLUTE will result in a | |
977 | completely empty and thus invalid object. As long as there is a non | |
978 | empty file name the result of normalization will be valid however. | |
979 | ||
980 | @param flags | |
981 | The kind of normalization to do with the file name. It can be | |
982 | any or-combination of the ::wxPathNormalize enumeration values. | |
983 | @param cwd | |
984 | If not empty, this directory will be used instead of current | |
985 | working directory in normalization (see @c wxPATH_NORM_ABSOLUTE). | |
986 | @param format | |
987 | The file name format to use when processing the paths, native by default. | |
988 | ||
989 | @return @true if normalization was successfully or @false otherwise. | |
990 | */ | |
991 | bool Normalize(int flags = wxPATH_NORM_ALL, | |
992 | const wxString& cwd = wxEmptyString, | |
993 | wxPathFormat format = wxPATH_NATIVE); | |
994 | ||
995 | /** | |
996 | Prepends a directory to the file path. | |
997 | Please see AppendDir() for important notes. | |
998 | */ | |
999 | void PrependDir(const wxString& dir); | |
1000 | ||
1001 | /** | |
1002 | Removes the specified directory component from the path. | |
1003 | ||
1004 | @see GetDirCount() | |
1005 | */ | |
1006 | void RemoveDir(size_t pos); | |
1007 | ||
1008 | /** | |
1009 | Removes last directory component from the path. | |
1010 | */ | |
1011 | void RemoveLastDir(); | |
1012 | ||
1013 | /** | |
1014 | If the path contains the value of the environment variable named @a envname | |
1015 | then this function replaces it with the string obtained from | |
1016 | wxString::Format(replacementFmtString, value_of_envname_variable). | |
1017 | ||
1018 | This function is useful to make the path shorter or to make it dependent | |
1019 | from a certain environment variable. | |
1020 | Normalize() with @c wxPATH_NORM_ENV_VARS can perform the opposite of this | |
1021 | function (depending on the value of @a replacementFmtString). | |
1022 | ||
1023 | The name and extension of this filename are not modified. | |
1024 | ||
1025 | Example: | |
1026 | @code | |
1027 | wxFileName fn("/usr/openwin/lib/someFile"); | |
1028 | fn.ReplaceEnvVariable("OPENWINHOME"); | |
1029 | // now fn.GetFullPath() == "$OPENWINHOME/lib/someFile" | |
1030 | @endcode | |
1031 | ||
1032 | @since 2.9.0 | |
1033 | ||
1034 | @return @true if the operation was successful (which doesn't mean | |
1035 | that something was actually replaced, just that ::wxGetEnv | |
1036 | didn't fail). | |
1037 | */ | |
1038 | bool ReplaceEnvVariable(const wxString& envname, | |
1039 | const wxString& replacementFmtString = "$%s", | |
1040 | wxPathFormat format = wxPATH_NATIVE); | |
1041 | ||
1042 | /** | |
1043 | Replaces, if present in the path, the home directory for the given user | |
1044 | (see ::wxGetHomeDir) with a tilde (~). | |
1045 | ||
1046 | Normalize() with @c wxPATH_NORM_TILDE performs the opposite of this | |
1047 | function. | |
1048 | ||
1049 | The name and extension of this filename are not modified. | |
1050 | ||
1051 | @since 2.9.0 | |
1052 | ||
1053 | @return @true if the operation was successful (which doesn't mean | |
1054 | that something was actually replaced, just that ::wxGetHomeDir | |
1055 | didn't fail). | |
1056 | */ | |
1057 | bool ReplaceHomeDir(wxPathFormat format = wxPATH_NATIVE); | |
1058 | ||
1059 | ||
1060 | /** | |
1061 | Deletes the specified directory from the file system. | |
1062 | ||
1063 | @param flags | |
1064 | Can contain one of wxPATH_RMDIR_FULL or wxPATH_RMDIR_RECURSIVE. By | |
1065 | default contains neither so the directory will not be removed | |
1066 | unless it is empty. | |
1067 | ||
1068 | @return Returns @true if the directory was successfully deleted, @false | |
1069 | otherwise. | |
1070 | */ | |
1071 | bool Rmdir(int flags = 0) const; | |
1072 | ||
1073 | /** | |
1074 | Deletes the specified directory from the file system. | |
1075 | ||
1076 | @param dir | |
1077 | The directory to delete | |
1078 | @param flags | |
1079 | Can contain one of wxPATH_RMDIR_FULL or wxPATH_RMDIR_RECURSIVE. By | |
1080 | default contains neither so the directory will not be removed | |
1081 | unless it is empty. | |
1082 | ||
1083 | @return Returns @true if the directory was successfully deleted, @false | |
1084 | otherwise. | |
1085 | */ | |
1086 | static bool Rmdir(const wxString& dir, int flags = 0); | |
1087 | ||
1088 | /** | |
1089 | Compares the filename using the rules of this platform. | |
1090 | */ | |
1091 | bool SameAs(const wxFileName& filepath, | |
1092 | wxPathFormat format = wxPATH_NATIVE) const; | |
1093 | ||
1094 | /** | |
1095 | Changes the current working directory. | |
1096 | */ | |
1097 | bool SetCwd() const; | |
1098 | ||
1099 | /** | |
1100 | Changes the current working directory. | |
1101 | */ | |
1102 | static bool SetCwd(const wxString& cwd); | |
1103 | ||
1104 | /** | |
1105 | Sets the extension of the file name to be an empty extension. | |
1106 | This is different from having no extension at all as the file | |
1107 | name will have a trailing dot after a call to this method. | |
1108 | ||
1109 | @see SetExt(), ClearExt() | |
1110 | */ | |
1111 | void SetEmptyExt(); | |
1112 | ||
1113 | /** | |
1114 | Sets the extension of the file name. | |
1115 | ||
1116 | Setting an empty string as the extension will remove the extension | |
1117 | resulting in a file name without a trailing dot, unlike a call to | |
1118 | SetEmptyExt(). | |
1119 | ||
1120 | @see SetEmptyExt(), ClearExt() | |
1121 | */ | |
1122 | void SetExt(const wxString& ext); | |
1123 | ||
1124 | /** | |
1125 | The full name is the file name and extension (but without the path). | |
1126 | */ | |
1127 | void SetFullName(const wxString& fullname); | |
1128 | ||
1129 | /** | |
1130 | Sets the name part (without extension). | |
1131 | ||
1132 | @see SetFullName() | |
1133 | */ | |
1134 | void SetName(const wxString& name); | |
1135 | ||
1136 | /** | |
1137 | Sets the full path. | |
1138 | ||
1139 | The @a path argument includes both the path (and the volume, if | |
1140 | supported by @a format) and the name and extension. | |
1141 | ||
1142 | @see GetPath() | |
1143 | */ | |
1144 | void SetPath(const wxString& path, wxPathFormat format = wxPATH_NATIVE); | |
1145 | ||
1146 | /** | |
1147 | Sets the file creation and last access/modification times (any of the pointers | |
1148 | may be @NULL). | |
1149 | */ | |
1150 | bool SetTimes(const wxDateTime* dtAccess, | |
1151 | const wxDateTime* dtMod, | |
1152 | const wxDateTime* dtCreate) const; | |
1153 | ||
1154 | /** | |
1155 | Sets the volume specifier. | |
1156 | */ | |
1157 | void SetVolume(const wxString& volume); | |
1158 | ||
1159 | //@{ | |
1160 | /** | |
1161 | This function splits a full file name into components: the volume (with the | |
1162 | first version) path (including the volume in the second version), the base name | |
1163 | and the extension. | |
1164 | ||
1165 | Any of the output parameters (@e volume, @e path, @a name or @e ext) may | |
1166 | be @NULL if you are not interested in the value of a particular component. | |
1167 | Also, @a fullpath may be empty on entry. | |
1168 | On return, @a path contains the file path (without the trailing separator), | |
1169 | @a name contains the file name and @a ext contains the file extension | |
1170 | without leading dot. All three of them may be empty if the corresponding | |
1171 | component is. The old contents of the strings pointed to by these parameters | |
1172 | will be overwritten in any case (if the pointers are not @NULL). | |
1173 | ||
1174 | Note that for a filename "foo." the extension is present, as indicated by the | |
1175 | trailing dot, but empty. If you need to cope with such cases, you should use | |
1176 | @a hasExt instead of relying on testing whether @a ext is empty or not. | |
1177 | */ | |
1178 | static void SplitPath(const wxString& fullpath, | |
1179 | wxString* volume, | |
1180 | wxString* path, | |
1181 | wxString* name, | |
1182 | wxString* ext, | |
1183 | bool* hasExt = NULL, | |
1184 | wxPathFormat format = wxPATH_NATIVE); | |
1185 | static void SplitPath(const wxString& fullpath, | |
1186 | wxString* volume, | |
1187 | wxString* path, | |
1188 | wxString* name, | |
1189 | wxString* ext, | |
1190 | wxPathFormat format); | |
1191 | static void SplitPath(const wxString& fullpath, | |
1192 | wxString* path, | |
1193 | wxString* name, | |
1194 | wxString* ext, | |
1195 | wxPathFormat format = wxPATH_NATIVE); | |
1196 | //@} | |
1197 | ||
1198 | /** | |
1199 | Splits the given @a fullpath into the volume part (which may be empty) and | |
1200 | the pure path part, not containing any volume. | |
1201 | ||
1202 | @see SplitPath() | |
1203 | */ | |
1204 | static void SplitVolume(const wxString& fullpath, | |
1205 | wxString* volume, | |
1206 | wxString* path, | |
1207 | wxPathFormat format = wxPATH_NATIVE); | |
1208 | ||
1209 | ||
1210 | /** | |
1211 | Strip the file extension. | |
1212 | ||
1213 | This function does more than just removing everything after the last | |
1214 | period from the string, for example it will return the string ".vimrc" | |
1215 | unchanged because the part after the period is not an extension but the | |
1216 | file name in this case. You can use wxString::BeforeLast() to really | |
1217 | get just the part before the last period (but notice that that function | |
1218 | returns empty string if period is not present at all unlike this | |
1219 | function which returns the @a fullname unchanged in this case). | |
1220 | ||
1221 | @param fullname | |
1222 | File path including name and, optionally, extension. | |
1223 | ||
1224 | @return | |
1225 | File path without extension | |
1226 | ||
1227 | @since 2.9.0 | |
1228 | */ | |
1229 | static wxString StripExtension(const wxString& fullname); | |
1230 | ||
1231 | /** | |
1232 | Sets the access and modification times to the current moment. | |
1233 | */ | |
1234 | bool Touch() const; | |
1235 | ||
1236 | /** | |
1237 | Returns @true if the filenames are different. The string @e filenames | |
1238 | is interpreted as a path in the native filename format. | |
1239 | */ | |
1240 | bool operator!=(const wxFileName& filename) const; | |
1241 | ||
1242 | /** | |
1243 | Returns @true if the filenames are different. The string @e filenames | |
1244 | is interpreted as a path in the native filename format. | |
1245 | */ | |
1246 | bool operator!=(const wxString& filename) const; | |
1247 | ||
1248 | /** | |
1249 | Returns @true if the filenames are equal. The string @e filenames is | |
1250 | interpreted as a path in the native filename format. | |
1251 | */ | |
1252 | bool operator==(const wxFileName& filename) const; | |
1253 | ||
1254 | /** | |
1255 | Returns @true if the filenames are equal. The string @e filenames is | |
1256 | interpreted as a path in the native filename format. | |
1257 | */ | |
1258 | bool operator==(const wxString& filename) const; | |
1259 | ||
1260 | /** | |
1261 | Assigns the new value to this filename object. | |
1262 | */ | |
1263 | wxFileName& operator=(const wxFileName& filename); | |
1264 | ||
1265 | /** | |
1266 | Assigns the new value to this filename object. | |
1267 | */ | |
1268 | wxFileName& operator=(const wxString& filename); | |
1269 | }; |