Ensure archives without ext are given .zip

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21423
This commit is contained in:
Seth Hillbrand 2025-08-15 13:25:17 -07:00
parent 1166cacc64
commit 2ded7b87af
2 changed files with 16 additions and 1 deletions

View File

@ -24,6 +24,7 @@
#include <wx/zipstrm.h>
#include <gestfich.h>
#include <common.h>
#include <wildcards_and_files_ext.h>
JOBS_OUTPUT_ARCHIVE::JOBS_OUTPUT_ARCHIVE() :
JOBS_OUTPUT_HANDLER(),
@ -52,6 +53,8 @@ bool JOBS_OUTPUT_ARCHIVE::HandleOutputs( const wxString& baseTempPath, PROJECT*
if( outputPath.StartsWith( "~" ) )
outputPath.Replace( "~", wxGetHomeDir(), false );
outputPath = EnsureFileExtension( outputPath, FILEEXT::ArchiveFileExtension );
wxFFileOutputStream ostream( outputPath );
if( !ostream.IsOk() ) // issue to create the file. Perhaps not writable dir

View File

@ -104,7 +104,19 @@ void DIALOG_DESTINATION::onOutputPathBrowseClicked(wxCommandEvent& event)
if( dlg.ShowModal() != wxID_OK )
return;
m_textCtrlOutputPath->SetValue( dlg.GetPath() );
wxString path = dlg.GetPath();
if( m_destination->m_type == JOBSET_DESTINATION_T::ARCHIVE )
{
wxFileName fn( path );
if( fn.GetExt().IsEmpty() )
fn.SetExt( FILEEXT::ArchiveFileExtension );
path = fn.GetFullPath();
}
m_textCtrlOutputPath->SetValue( path );
}
}