X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8907154c1a8a6882c6797d1f16393ddfb23e7f3a..345319d60c69cac3f5e9e74ee570d20370fc532f:/include/wx/filename.h diff --git a/include/wx/filename.h b/include/wx/filename.h index 547d080fc7..5154ed057e 100644 --- a/include/wx/filename.h +++ b/include/wx/filename.h @@ -12,11 +12,6 @@ #ifndef _WX_FILENAME_H_ #define _WX_FILENAME_H_ -#ifndef WX_PRECOMP - #include "wx/string.h" - #include "wx/arrstr.h" -#endif - /* TODO: @@ -24,15 +19,16 @@ 2. more file operations: a) chmod() b) [acm]time() - get and set - c) file size - d) file permissions with readable accessors for most common bits + c) file permissions with readable accessors for most common bits such as IsReadable() &c - e) rename()? + d) rename()? 3. SameFileAs() function to compare inodes under Unix */ +#include "wx/arrstr.h" #include "wx/filefn.h" #include "wx/datetime.h" +#include "wx/intl.h" #if wxUSE_FILE class WXDLLIMPEXP_BASE wxFile; @@ -86,6 +82,10 @@ enum wxPATH_MKDIR_FULL = 0x0001 // create directories recursively }; +// error code of wxFileName::GetSize() +extern wxULongLong wxInvalidSize; + + // ---------------------------------------------------------------------------- // wxFileName: encapsulates a file path // ---------------------------------------------------------------------------- @@ -439,6 +439,20 @@ public: wxString *path, wxPathFormat format = wxPATH_NATIVE); + // Filesize + + // returns the size of the given filename + wxULongLong GetSize() const; + 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); + + // deprecated methods, don't use any more // -------------------------------------- @@ -447,7 +461,7 @@ public: { return GetPath(withSep ? wxPATH_GET_SEPARATOR : 0, format); } #endif wxString GetPathWithSep(wxPathFormat format = wxPATH_NATIVE ) const - { return GetPath(wxPATH_GET_SEPARATOR, format); } + { return GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR, format); } private: // check whether this dir is valid for Append/Prepend/InsertDir()