aboutsummaryrefslogtreecommitdiff
path: root/tools/mhmake/src/fileinfo.cpp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-01-31 10:29:48 +0100
committermarha <marha@users.sourceforge.net>2013-01-31 10:29:48 +0100
commit49c196c1056aaed97ff5cf43beff5c436d783b99 (patch)
tree6fb821e2c4d3d4c0eedbd53fe0f37dce29412037 /tools/mhmake/src/fileinfo.cpp
parentb77427f7685360a51b4e2384ef4d0235723b410e (diff)
downloadvcxsrv-49c196c1056aaed97ff5cf43beff5c436d783b99.tar.gz
vcxsrv-49c196c1056aaed97ff5cf43beff5c436d783b99.tar.bz2
vcxsrv-49c196c1056aaed97ff5cf43beff5c436d783b99.zip
mhmake: solved file date checking on 64-bit windows
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
}
///////////////////////////////////////////////////////////////////////////////