X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f0ce3409421a7c5c800a2255295274187220e8de..551fe3a6f024a542d26ce8da202d76d8c83f3a6f:/src/common/filename.cpp diff --git a/src/common/filename.cpp b/src/common/filename.cpp index 610a7c2993..041e24a1f4 100644 --- a/src/common/filename.cpp +++ b/src/common/filename.cpp @@ -48,6 +48,19 @@ #include "wx/msw/winundef.h" #endif +// at least some of these are required for file mod time +#ifdef __WXGTK__ +#include +#include +#include +#include +#ifndef __VMS +# include +#endif +# include +#include +#endif + // ============================================================================ // implementation // ============================================================================ @@ -152,6 +165,29 @@ bool wxFileName::DirExists( const wxString &dir ) return ::wxDirExists( dir ); } +wxDateTime wxFileName::GetModificationTime() +{ +#ifdef __WXGTK__ + struct stat buff; + stat( GetFullName().fn_str(), &buff ); + +#if !defined( __EMX__ ) && !defined(__VMS) + struct stat lbuff; + lstat( GetFullName().fn_str(), &lbuff ); + struct tm *t = localtime( &lbuff.st_mtime ); +#else + struct tm *t = localtime( &buff.st_mtime ); +#endif + + wxDateTime ret( t->tm_mday, (wxDateTime::Month)t->tm_mon, t->tm_year+1900, t->tm_hour, t->tm_min, t->tm_sec ); +#else + + wxDateTime ret = wxDateTime::Now(); + +#endif + return ret; +} + // ---------------------------------------------------------------------------- // CWD and HOME stuff // ---------------------------------------------------------------------------- @@ -215,6 +251,7 @@ bool wxFileName::Mkdir( const wxString &dir, int perm, bool full ) { wxFileName filename(dir); wxArrayString dirs = filename.GetDirs(); + dirs.Add(filename.GetName()); size_t count = dirs.GetCount(); size_t i; @@ -620,7 +657,10 @@ wxString wxFileName::GetLongPath() const HANDLE hFind; pathOut = wxEmptyString; - size_t count = m_dirs.GetCount(); + wxArrayString dirs = GetDirs(); + dirs.Add(GetName()); + + size_t count = dirs.GetCount(); size_t i; wxString tmpPath; @@ -628,7 +668,7 @@ wxString wxFileName::GetLongPath() const { // We're using pathOut to collect the long-name path, // but using a temporary for appending the last path component which may be short-name - tmpPath = pathOut + m_dirs[i]; + tmpPath = pathOut + dirs[i]; if (tmpPath.Last() == wxT(':')) {