// this symbol is defined for the platforms where file systems use volumes in
// paths
-#if defined(__WXMSW__) || defined(__DOS__) || defined(__OS2__)
+#if defined(__WINDOWS__) || defined(__DOS__) || defined(__OS2__)
#define wxHAS_FILESYSTEM_VOLUMES
#endif
wxPATH_MAX // Not a valid value for specifying path format
};
+// different conventions that may be used with GetHumanReadableSize()
+enum wxSizeConvention
+{
+ wxSIZE_CONV_TRADITIONAL, // 1024 bytes = 1 KB
+ wxSIZE_CONV_IEC, // 1024 bytes = 1 KiB
+ wxSIZE_CONV_SI // 1000 bytes = 1 KB
+};
+
// the kind of normalization to do with the file name: these values can be
// or'd together to perform several operations at once
enum wxPathNormalize
{
wxPATH_NORM_ENV_VARS = 0x0001, // replace env vars with their values
- wxPATH_NORM_DOTS = 0x0002, // squeeze all .. and . and prepend cwd
+ wxPATH_NORM_DOTS = 0x0002, // squeeze all .. and .
wxPATH_NORM_TILDE = 0x0004, // Unix only: replace ~ and ~user
wxPATH_NORM_CASE = 0x0008, // if case insensitive => tolower
wxPATH_NORM_ABSOLUTE = 0x0010, // make the path absolute
!m_ext.empty() || m_hasExt;
}
- // does the file with this name exists?
+ // does the file with this name exist?
bool FileExists() const;
static bool FileExists( const wxString &file );
- // does the directory with this name exists?
+ // does the directory with this name exist?
bool DirExists() const;
static bool DirExists( const wxString &dir );
+ // does anything at all with this name (i.e. file, directory or some
+ // other file system object such as a device, socket, ...) exist?
+ bool Exists() const { return Exists(GetFullPath()); }
+ static bool Exists(const wxString& path);
+
+
// checks on most common flags for files/directories;
// more platform-specific features (like e.g. Unix permissions) are not
// available in wxFileName
// is the char a path separator for this format?
static bool IsPathSeparator(wxChar ch, wxPathFormat format = wxPATH_NATIVE);
+ // is this is a DOS path which beings with a windows unique volume name
+ // ('\\?\Volume{guid}\')?
+ static bool IsMSWUniqueVolumeNamePath(const wxString& path,
+ wxPathFormat format = wxPATH_NATIVE);
+
// Dir accessors
size_t GetDirCount() const { return m_dirs.size(); }
void AppendDir(const wxString& dir);
static wxULongLong GetSize(const wxString &file);
// returns the size in a human readable form
- wxString GetHumanReadableSize(const wxString &nullsize = wxGetTranslation(_T("Not available")),
- int precision = 1) const;
- static wxString GetHumanReadableSize(const wxULongLong &sz,
- const wxString &nullsize = wxGetTranslation(_T("Not available")),
- int precision = 1);
+ wxString
+ GetHumanReadableSize(const wxString& nullsize = _("Not available"),
+ int precision = 1,
+ wxSizeConvention conv = wxSIZE_CONV_TRADITIONAL) const;
+ static wxString
+ GetHumanReadableSize(const wxULongLong& sz,
+ const wxString& nullsize = _("Not available"),
+ int precision = 1,
+ wxSizeConvention conv = wxSIZE_CONV_TRADITIONAL);
#endif // wxUSE_LONGLONG