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.cpp40
1 files changed, 7 insertions, 33 deletions
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<fileinfo> 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<rule>&pRule)
#endif
///////////////////////////////////////////////////////////////////////////////
-static inline string &NormalizePathName(string &Name)
+string &NormalizePathName(string &Name)
{
const char *pPtr=Name.c_str();
const char *pBeg=pPtr;