From 0a7d4d3a18179c0d2cff96c53c2608314474c886 Mon Sep 17 00:00:00 2001 From: cas Date: Tue, 22 Feb 2000 18:09:04 +0000 Subject: [PATCH] No comments --- src/WOKStep/WOKStep_Include.cxx | 79 ++++++++++++++++++++++++--------- 1 file changed, 58 insertions(+), 21 deletions(-) diff --git a/src/WOKStep/WOKStep_Include.cxx b/src/WOKStep/WOKStep_Include.cxx index d481452..160506a 100755 --- a/src/WOKStep/WOKStep_Include.cxx +++ b/src/WOKStep/WOKStep_Include.cxx @@ -6,8 +6,8 @@ #ifdef WNT # include #else -# include #endif // WNT +#include #include @@ -31,6 +31,8 @@ #include #ifdef WNT +# define WIN32_LEAN_AND_MEAN +# include # include # include @@ -41,6 +43,8 @@ extern "C" __declspec( dllimport ) int wokCMP ( int, char** ); # define WOKStep_Include_SYMLINK 0 # if !WOKStep_Include_SYMLINK # include +# include +# include # endif // !WOKStep_Include_SYMLINK #endif // WNT @@ -128,7 +132,7 @@ void WOKStep_Include::Execute(const Handle(WOKMake_HSequenceOfInputFile)& tobuil Handle(WOKernel_FileType) pubinctype = Unit()->FileTypeBase()->Type("pubinclude"); Handle(WOKMake_InputFile) infile; - + for(i=1; i<=tobuild->Length(); i++) { #ifdef WNT @@ -142,13 +146,12 @@ void WOKStep_Include::Execute(const Handle(WOKMake_HSequenceOfInputFile)& tobuil if(infile->File()->Nesting()->IsSameString(Unit()->FullName())) { - if(pubincfile->Path()->Exists()) - { - pubincfile->Path()->RemoveFile(); - } - #ifndef WNT # if WOKStep_Include_SYMLINK + if(pubincfile->Path()->Exists()) + { + pubincfile->Path()->RemoveFile(); + } symlink(infile->File()->Path()->Name()->ToCString(), pubincfile->Path()->Name()->ToCString()); # else if ( !pubincfile -> Path () -> Exists () || @@ -159,6 +162,8 @@ void WOKStep_Include::Execute(const Handle(WOKMake_HSequenceOfInputFile)& tobuil OSD_File fSrc ( pSrc ); OSD_Path pDst ( pubincfile -> Path () -> Name () -> String () ); + chmod ( pubincfile -> Path () -> Name () -> ToCString (), 00644 ); + fSrc.Copy ( pDst ); if ( fSrc.Failed () ) { @@ -174,23 +179,55 @@ void WOKStep_Include::Execute(const Handle(WOKMake_HSequenceOfInputFile)& tobuil } // end if + struct utimbuf times; + struct stat buf; + + stat ( infile -> File () -> Path () -> Name () -> ToCString (), &buf ); + + times.actime = buf.st_atime; + times.modtime = buf.st_mtime; + + utime ( pubincfile -> Path () -> Name () -> ToCString (), × ); + } // end if # endif // WOKStep_Incluse_SYMLINK #else - Standard_CString CmpArgs[4]; - - CmpArgs[0] = "wokCMP"; - CmpArgs[1] = infile->File()->Path()->Name()->ToCString(); - CmpArgs[2] = pubincfile->Path()->Name()->ToCString(); - if(wokCMP(3, CmpArgs)) - { - Standard_CString CpArgs[4]; - - CpArgs[0] = "wokCP"; - CpArgs[1] = infile->File()->Path()->Name()->ToCString(); - CpArgs[2] = pubincfile->Path()->Name()->ToCString(); - wokCP(3, CpArgs); - } + Standard_CString args[ 4 ]; + + args[ 0 ] = "wokCMP"; + args[ 1 ] = infile -> File () -> Path () -> Name () -> ToCString (); + args[ 2 ] = pubincfile -> Path () -> Name () -> ToCString (); + + if ( wokCMP ( 3, args ) ) { + + HANDLE hFile; + FILETIME cTime, aTime, wTime; + + args[ 0 ] = "wokCP"; + wokCP ( 3, args ); + + hFile = CreateFileA ( + args[ 1 ], GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL + ); + + if ( hFile != INVALID_HANDLE_VALUE ) { + + if ( GetFileTime ( hFile, &cTime, &aTime, &wTime ) ) { + + CloseHandle ( hFile ); + hFile = CreateFileA ( + args[ 2 ], GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL + ); + + if ( hFile != INVALID_HANDLE_VALUE ) SetFileTime ( hFile, &cTime, &aTime, &wTime ); + + } // end if + + CloseHandle ( hFile ); + + } // end if + + } // end if #endif } else -- 2.39.5