EgtGeneral 2.2f1 :

- aggiunta funzione CompareFilesLastWriteTime.
This commit is contained in:
Dario Sassi
2020-06-12 07:34:16 +00:00
parent 9e9d2a3833
commit 3e15d2222b
2 changed files with 26 additions and 0 deletions
+26
View File
@@ -61,6 +61,32 @@ EraseFile( const string& sFile)
return ( ::DeleteFileW( stringtoW( sFile)) != 0) ;
}
//-----------------------------------------------------------------------------
static bool
GetFileLastWriteTime( const string& sFile, FILETIME& ftWrite)
{
HANDLE hFile = CreateFileW( stringtoW( sFile), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL) ;
if ( hFile == INVALID_HANDLE_VALUE)
return false ;
bool bOk = ( GetFileTime( hFile, NULL, NULL, &ftWrite) != FALSE) ;
CloseHandle( hFile) ;
return bOk ;
}
//-----------------------------------------------------------------------------
bool
CompareFilesLastWriteTime( const string& sFile1, const string& sFile2, int& nRes)
{
FILETIME ftWrite1 ;
if ( ! GetFileLastWriteTime( sFile1, ftWrite1))
return false ;
FILETIME ftWrite2 ;
if ( ! GetFileLastWriteTime( sFile2, ftWrite2))
return false ;
nRes = CompareFileTime( &ftWrite1, &ftWrite2) ;
return true ;
}
//-----------------------------------------------------------------------------
string
ChangeFileExtension( const string& sFile, const string& sNewExt)