Added wxFileName::GetModificationTime()

for Unix.
  Don't send events when constructing a text ctrl.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9691 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2001-04-09 17:16:09 +00:00
parent 068cfb66c2
commit ce16e5d78f
4 changed files with 48 additions and 8 deletions

View File

@@ -48,6 +48,19 @@
#include "wx/msw/winundef.h"
#endif
// at least some of these are required for file mod time
#ifdef __WXGTK__
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <pwd.h>
#ifndef __VMS
# include <grp.h>
#endif
# include <time.h>
#include <unistd.h>
#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
// ----------------------------------------------------------------------------