From 714c4e1fbad5c9184bc3280ede81ddf417f72642 Mon Sep 17 00:00:00 2001 From: DarioS Date: Tue, 28 Dec 2021 08:31:36 +0100 Subject: [PATCH] EgtGeneral 2.3l1 : - in CopyFileEgt si copia esplicitamente la data di ultima modifica dal file originale. --- EgtGeneral.rc | Bin 11630 -> 11638 bytes FileUtils.cpp | 22 ++++++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/EgtGeneral.rc b/EgtGeneral.rc index 0aed8103bc3e3ebb5a6aff884e47dba2a52ace18..ec995a431dca69a3f2b9b1adbd168eb763b8109f 100644 GIT binary patch delta 110 zcmaDC^(|_{H#TNN2BXcZ#m+NLekZImIY5wO@-I#q#+=Rn1v42pH*h;KLlsyvg9TT! Vpz^aBHwQ^Oz!YIOMMgP@3jmQOC5iw5 delta 118 zcmews^)70|H#SC#%^SteGfloDtuy(apbB#agW=?jg1Vb!q^uY>H*q^LgB4gaBT3jW TZq5^Sz#>t@g4Z+^ using namespace std ; @@ -44,7 +44,25 @@ ExistsFile( const string& sFile) bool CopyFileEgt( const string& sFile, const string& sNewFile) { - return ( ::CopyFileW( stringtoW( sFile), stringtoW( sNewFile), false) != 0) ; + // copio file + if ( ::CopyFileW( stringtoW( sFile), stringtoW( sNewFile), false) == 0) + return false ; + // recupero data ultima scrittura file sorgente + HANDLE hFile = CreateFileW( stringtoW( sFile), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL) ; + if ( hFile == INVALID_HANDLE_VALUE) + return true ; + FILETIME ftWrite ; + bool bOk = ( GetFileTime( hFile, NULL, NULL, &ftWrite) != FALSE) ; + CloseHandle( hFile) ; + if ( ! bOk) + return true ; + // scrivo data ultima scrittura file destinazione + HANDLE hNewFile = CreateFileW( stringtoW( sNewFile), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL) ; + if ( hNewFile == INVALID_HANDLE_VALUE) + return true ; + bool bNewOk = ( SetFileTime( hNewFile, NULL, NULL, &ftWrite) != FALSE) ; + CloseHandle( hNewFile) ; + return true ; } //-----------------------------------------------------------------------------