wxPATH_NORM_ALL = 0x00ff & ~wxPATH_NORM_CASE
};
+/**
+ Flags for wxFileName::Rmdir().
+ */
+enum
+{
+ /// Delete the specified directory and its subdirectories if they are empty.
+ wxPATH_RMDIR_FULL = 1,
+
+ /**
+ Delete the specified directory and all the files and subdirectories in it
+ recursively.
+
+ This flag is obviously @b dangerous and should be used with care and
+ after asking the user for confirmation.
+ */
+ wxPATH_RMDIR_RECURSIVE = 2
+};
+
/**
The return value of wxFileName::GetSize() in case of error.
*/
@see GetCwd()
*/
- static void AssignCwd(const wxString& volume = wxEmptyString);
+ void AssignCwd(const wxString& volume = wxEmptyString);
/**
Sets this file name object to the given directory name.
*/
void ClearExt();
+ //@{
/**
Returns a temporary file name starting with the given @e prefix.
If the @a prefix is an absolute path, the temporary file is created in this
*/
static wxString CreateTempFileName(const wxString& prefix,
wxFile* fileTemp = NULL);
+ static wxString CreateTempFileName(const wxString& prefix,
+ wxFFile* fileTemp = NULL);
+ //@}
/**
Returns @true if the directory with this name exists.
not be read (because e.g. the file is locked by another process) the returned
value is ::wxInvalidSize.
*/
- const static wxULongLong GetSize(const wxString& filename);
+ static wxULongLong GetSize(const wxString& filename);
/**
Returns the directory used for temporary files.
/**
Deletes the specified directory from the file system.
+
+ @param flags
+ Can contain one of wxPATH_RMDIR_FULL or wxPATH_RMDIR_RECURSIVE. By
+ default contains neither so the directory will not be removed
+ unless it is empty.
+
+ @return Returns @true if the directory was successfully deleted, @false
+ otherwise.
*/
- bool Rmdir();
+ bool Rmdir(int flags = 0);
/**
Deletes the specified directory from the file system.
+
+ @param dir
+ The directory to delete
+ @param flags
+ Can contain one of wxPATH_RMDIR_FULL or wxPATH_RMDIR_RECURSIVE. By
+ default contains neither so the directory will not be removed
+ unless it is empty.
+
+ @return Returns @true if the directory was successfully deleted, @false
+ otherwise.
*/
- static bool Rmdir(const wxString& dir);
+ static bool Rmdir(const wxString& dir, int flags = 0);
/**
Compares the filename using the rules of this platform.
trailing dot, but empty. If you need to cope with such cases, you should use
@a hasExt instead of relying on testing whether @a ext is empty or not.
*/
- static void SplitPath(const wxString& fullpath, wxString* volume,
+ static void SplitPath(const wxString& fullpath,
+ wxString* volume,
wxString* path,
wxString* name,
wxString* ext,
- bool hasExt = NULL,
+ bool* hasExt = NULL,
wxPathFormat format = wxPATH_NATIVE);
static void SplitPath(const wxString& fullpath,
wxString* volume,
wxString* path,
wxString* name,
wxString* ext,
- wxPathFormat format = wxPATH_NATIVE);
+ wxPathFormat format);
static void SplitPath(const wxString& fullpath,
wxString* path,
wxString* name,
wxString* path,
wxPathFormat format = wxPATH_NATIVE);
+
+ /**
+ Strip the file extension.
+
+ This function does more than just removing everything after the last
+ period from the string, for example it will return the string ".vimrc"
+ unchanged because the part after the period is not an extension but the
+ file name in this case. You can use wxString::BeforeLast() to really
+ get just the part before the last period (but notice that that function
+ returns empty string if period is not present at all unlike this
+ function which returns the @a fullname unchanged in this case).
+
+ @param fullname
+ File path including name and, optionally, extension.
+
+ @return
+ File path without extension
+
+ @since 2.9.0
+ */
+ static wxString StripExtension(const wxString& fullname);
+
/**
Sets the access and modification times to the current moment.
*/
*/
wxFileName& operator=(const wxString& filename);
};
-