"Kicad PROJECT_ARCHIVER: do not store twice files with extension .gm?"

Better fix than commit 8255e091f0.
It also fixes duplicates for ext like *.g1
From master branch.
This commit is contained in:
jean-pierre charras 2023-11-21 15:51:19 +01:00
parent 4f060d9384
commit 1740aeca5e
1 changed files with 9 additions and 1 deletions

View File

@ -135,7 +135,7 @@ bool PROJECT_ARCHIVER::Archive( const wxString& aSrcDir, const wxString& aDestFi
wxT( "*.stp" ), wxT( "*.step" ), // 3d files wxT( "*.stp" ), wxT( "*.step" ), // 3d files
wxT( "*.wrl" ), wxT( "*.wrl" ),
wxT( "*.g?" ), wxT( "*.g??" ), // Gerber files wxT( "*.g?" ), wxT( "*.g??" ), // Gerber files
wxT( "*.gbrjob" ), // Gerber job files wxT( "*.gm??" ), wxT( "*.gbrjob" ),
wxT( "*.pos" ), wxT( "*.drl" ), wxT( "*.nc" ), wxT( "*.xnc" ), // Fab files wxT( "*.pos" ), wxT( "*.drl" ), wxT( "*.nc" ), wxT( "*.xnc" ), // Fab files
wxT( "*.d356" ), wxT( "*.rpt" ), wxT( "*.d356" ), wxT( "*.rpt" ),
wxT( "*.net" ), wxT( "*.py" ), wxT( "*.net" ), wxT( "*.py" ),
@ -177,8 +177,16 @@ bool PROJECT_ARCHIVER::Archive( const wxString& aSrcDir, const wxString& aDestFi
unsigned long uncompressedBytes = 0; unsigned long uncompressedBytes = 0;
// Our filename collector can store duplicate filenames. for instance *.gm2
// matches both *.g?? and *.gm??.
// So skip duplicate filenames (they are sorted, so it is easy).
wxString lastStoredFile;
for( unsigned ii = 0; ii < files.GetCount(); ii++ ) for( unsigned ii = 0; ii < files.GetCount(); ii++ )
{ {
if( lastStoredFile == files[ii] ) // duplicate name: already stored
continue;
wxFileSystem fsfile; wxFileSystem fsfile;
wxFileName curr_fn( files[ii] ); wxFileName curr_fn( files[ii] );