Don't strip extensions twice in BOM export

Exporting the Bill of Materials uses the netlist exporter.  Both of
these routines were stripping the extension, leading to projects like
"test.project.kicad_pro" having the project name stripped.  We separate
the BOM netlist export from generic plugin netlist export to allow the
correct behavior when exporting netlists and generating BOMs

Fixes https://gitlab.com/kicad/code/kicad/issues/10270
This commit is contained in:
Seth Hillbrand 2022-01-05 11:05:18 -08:00
parent a05ec04ee8
commit bef762e652
3 changed files with 15 additions and 4 deletions

View File

@ -32,18 +32,19 @@
#include <bom_plugins.h>
#include <confirm.h>
#include <dialog_bom_base.h>
#include <string_utils.h>
#include <dialogs/html_message_box.h>
#include <eeschema_settings.h>
#include <gestfich.h>
#include <dialogs/html_message_box.h>
#include <i18n_utility.h> // for _HKI definition used in dialog_bom_help_md.h
#include <invoke_sch_dialog.h>
#include <kiface_base.h>
#include <netlist.h>
#include <netlist_exporter_xml.h>
#include <paths.h>
#include <pgm_base.h>
#include <reporter.h>
#include <sch_edit_frame.h>
#include <paths.h>
#include <string_utils.h>
#include <wx/filedlg.h>
#include <wx/log.h>
@ -343,7 +344,7 @@ void DIALOG_BOM::OnRunGenerator( wxCommandEvent& event )
#endif
if( m_parent->ReadyToNetlist( _( "Generating BOM requires a fully annotated schematic." ) ) )
m_parent->WriteNetListFile( -1, fullfilename, GNL_OPT_BOM, &reporter );
m_parent->WriteNetListFile( NET_TYPE_BOM, fullfilename, GNL_OPT_BOM, &reporter );
m_Messages->SetValue( reportmsg );

View File

@ -34,6 +34,7 @@
/// netlist types
enum NETLIST_TYPE_ID {
NET_TYPE_UNINIT = 0,
NET_TYPE_BOM, // Used by the BOM generator
NET_TYPE_PCBNEW,
NET_TYPE_ORCADPCB2,
NET_TYPE_CADSTAR,

View File

@ -81,6 +81,15 @@ bool SCH_EDIT_FRAME::WriteNetListFile( int aFormat, const wxString& aFullFileNam
helper = new NETLIST_EXPORTER_PSPICE( sch );
break;
case NET_TYPE_BOM:
// When generating the BOM, we have a bare filename so don't strip
// the extension or you might string a '.' from the middle of the filename
fileName += wxT( "." GENERIC_INTERMEDIATE_NETLIST_EXT );
helper = new NETLIST_EXPORTER_XML( sch );
executeCommandLine = true;
break;
default:
{
wxFileName tmpFile = fileName;