aboutsummaryrefslogtreecommitdiff
path: root/tools/mhmake/src/fileinfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/mhmake/src/fileinfo.cpp')
-rw-r--r--tools/mhmake/src/fileinfo.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/mhmake/src/fileinfo.cpp b/tools/mhmake/src/fileinfo.cpp
index 884d645b5..d9d16c1e3 100644
--- a/tools/mhmake/src/fileinfo.cpp
+++ b/tools/mhmake/src/fileinfo.cpp
@@ -96,6 +96,16 @@ string fileinfo::GetName() const
///////////////////////////////////////////////////////////////////////////////
mh_time_t fileinfo::realGetDate() const
{
+#ifdef WIN32
+ WIN32_FILE_ATTRIBUTE_DATA Attr;
+ BOOL Ret=GetFileAttributesEx(m_AbsFileName.c_str(), GetFileExInfoStandard, &Attr);
+ if (!Ret)
+ ((fileinfo*)this)->m_Date.SetNotExist();
+ else if (Attr.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)
+ ((fileinfo*)this)->m_Date.SetDir();
+ else
+ ((fileinfo*)this)->m_Date=*(mh_basetime_t*)&Attr.ftLastWriteTime;
+#else
struct stat Buf;
if (-1==stat(m_AbsFileName.c_str(),&Buf))
((fileinfo*)this)->m_Date.SetNotExist();
@@ -103,6 +113,7 @@ mh_time_t fileinfo::realGetDate() const
((fileinfo*)this)->m_Date.SetDir();
else
((fileinfo*)this)->m_Date=Buf.st_mtime;
+#endif
return m_Date;
}
@@ -141,7 +152,13 @@ bool fileinfo::IsDir() const
///////////////////////////////////////////////////////////////////////////////
void fileinfo::SetDateToNow()
{
+#ifdef WIN32
+ FILETIME ft;
+ GetSystemTimeAsFileTime(&ft);
+ m_Date=*(mh_basetime_t*)&ft;
+#else
m_Date=time(NULL);
+#endif
}
///////////////////////////////////////////////////////////////////////////////