From 24d6ec0750afd0c393bab09aabe174da824a8c56 Mon Sep 17 00:00:00 2001 From: marha Date: Thu, 18 Feb 2010 07:22:26 +0000 Subject: svn merge --reintegrate ^/branches/mhmake.parallel . --- tools/mhmake/src/fileinfo.cpp | 40 +++++++--------------------------------- 1 file changed, 7 insertions(+), 33 deletions(-) (limited to 'tools/mhmake/src/fileinfo.cpp') diff --git a/tools/mhmake/src/fileinfo.cpp b/tools/mhmake/src/fileinfo.cpp index 387b2816d..e0feb0a79 100644 --- a/tools/mhmake/src/fileinfo.cpp +++ b/tools/mhmake/src/fileinfo.cpp @@ -25,13 +25,13 @@ #include "util.h" #include "mhmakeparser.h" +#ifndef S_ISDIR +#define S_ISDIR(val) ((val)&_S_IFDIR) +#endif + const string NullString; refptr NullFileInfo; -#ifdef WIN32 -ZEROTIME g_ZeroTime; -#endif - /////////////////////////////////////////////////////////////////////////////// string QuoteFileName(const string &Filename) { @@ -92,27 +92,6 @@ string fileinfo::GetName() const /////////////////////////////////////////////////////////////////////////////// mh_time_t fileinfo::realGetDate() { -#ifdef WIN32 - WIN32_FIND_DATA FindData; - HANDLE hFind=FindFirstFile(m_AbsFileName.c_str(),&FindData); - if (hFind==INVALID_HANDLE_VALUE) - { - m_Date.SetNotExist(); - } - else - { - FindClose(hFind); - if (FindData.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) - { // For directories we just take an old time since the lastwritetime is changed each time something - // is added to the directory - m_Date.SetDir(); - } - else - { - m_Date=g_ZeroTime.ConvertTime(&FindData.ftLastWriteTime); - } - } -#else struct stat Buf; if (-1==stat(m_AbsFileName.c_str(),&Buf)) m_Date.SetNotExist(); @@ -120,7 +99,6 @@ mh_time_t fileinfo::realGetDate() m_Date.SetDir(); else m_Date=Buf.st_mtime; -#endif return m_Date; } @@ -157,16 +135,12 @@ bool fileinfo::IsDir() const } /////////////////////////////////////////////////////////////////////////////// +#ifdef _DEBUG void fileinfo::SetDateToNow() { -#ifdef WIN32 - FILETIME FileTime; - GetSystemTimeAsFileTime(&FileTime); - m_Date=g_ZeroTime.ConvertTime(&FileTime); -#else m_Date=time(NULL); -#endif } +#endif /////////////////////////////////////////////////////////////////////////////// string fileinfo::GetPrerequisits() const @@ -252,7 +226,7 @@ string fileinfo::GetErrorMessageDuplicateRule(const refptr&pRule) #endif /////////////////////////////////////////////////////////////////////////////// -static inline string &NormalizePathName(string &Name) +string &NormalizePathName(string &Name) { const char *pPtr=Name.c_str(); const char *pBeg=pPtr; -- cgit v1.2.3