Preserve archive timestamps on extract

Fix #9065
This commit is contained in:
Marek Roszko 2021-09-01 01:04:43 -04:00
parent b0ba8b01c4
commit b32b04d27e
1 changed files with 8 additions and 0 deletions

View File

@ -86,12 +86,20 @@ bool PROJECT_ARCHIVER::Unarchive( const wxString& aSrcFile, const wxString& aDes
if( entry->IsDir() )
continue;
wxTempFileOutputStream outputFileStream( fullname );
if( CopyStreamData( *archiveStream, outputFileStream, entry->GetSize() ) )
outputFileStream.Commit();
else
aReporter.Report( _( "Error extracting file!" ), RPT_SEVERITY_ERROR );
// Now let's set the filetimes based on what's in the zip
wxFileName outputFileName( fullname );
wxDateTime fileTime = entry->GetDateTime();
// For now we set access, mod, create to the same datetime
// create (third arg) is only used on Windows
outputFileName.SetTimes( &fileTime, &fileTime, &fileTime );
}
aReporter.Report( wxT( "Extracted project." ), RPT_SEVERITY_INFO );