+#if defined(__WIN32__)
+ // we must use different methods for the files and directories under
+ // Windows as CreateFile(GENERIC_READ) doesn't work for the directories and
+ // CreateFile(FILE_FLAG_BACKUP_SEMANTICS) works -- but only under NT and
+ // not 9x
+ bool ok;
+ FILETIME ftAccess, ftCreate, ftWrite;
+ if ( IsDir() )
+ {
+ // implemented in msw/dir.cpp
+ extern bool wxGetDirectoryTimes(const wxString& dirname,
+ FILETIME *, FILETIME *, FILETIME *);
+
+ // we should pass the path without the trailing separator to
+ // wxGetDirectoryTimes()
+ ok = wxGetDirectoryTimes(GetPath(wxPATH_GET_VOLUME),
+ &ftAccess, &ftCreate, &ftWrite);
+ }
+ else // file
+ {
+ wxFileHandle fh(GetFullPath(), wxFileHandle::Read);
+ if ( fh.IsOk() )
+ {
+ ok = ::GetFileTime(fh,
+ dtCreate ? &ftCreate : NULL,
+ dtAccess ? &ftAccess : NULL,
+ dtMod ? &ftWrite : NULL) != 0;
+ }
+ else
+ {
+ ok = false;
+ }
+ }
+
+ if ( ok )
+ {
+ if ( dtCreate )
+ ConvertFileTimeToWx(dtCreate, ftCreate);
+ if ( dtAccess )
+ ConvertFileTimeToWx(dtAccess, ftAccess);
+ if ( dtMod )
+ ConvertFileTimeToWx(dtMod, ftWrite);
+
+ return true;
+ }
+#elif defined(__UNIX_LIKE__) || defined(__WXMAC__) || (defined(__DOS__) && defined(__WATCOMC__))