filename.h 49 KB

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