From 991a92429e4587dde7b8cbe6eeac0aa32d20fce4 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 28 Apr 2013 11:10:54 +0200 Subject: [PATCH] Pcbbnew: fix bug Bug #1172892 (bad drill map file names, when a point is used inside a board file name) --- pcbnew/dialogs/dialog_gendrill.cpp | 15 +++++++-------- pcbnew/gendrill_Excellon_writer.h | 5 +++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pcbnew/dialogs/dialog_gendrill.cpp b/pcbnew/dialogs/dialog_gendrill.cpp index 9939f66aa2..958c72d326 100644 --- a/pcbnew/dialogs/dialog_gendrill.cpp +++ b/pcbnew/dialogs/dialog_gendrill.cpp @@ -440,9 +440,10 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles(bool aGenDrill, bool aGenMap) if( choice >= m_Choice_Drill_Map->GetCount() ) choice = 1; - fn.SetExt( wxEmptyString ); // Will be modified by GenDrillMap + fn.SetExt( wxEmptyString ); // Will be added by GenDrillMap + wxString fullfilename = fn.GetFullPath() + wxT( "-drl_map" ); - GenDrillMap( fn.GetFullPath(), excellonWriter, filefmt[choice] ); + GenDrillMap( fullfilename, excellonWriter, filefmt[choice] ); } } @@ -530,7 +531,7 @@ void DIALOG_GENDRILL::OnGenReportFile( wxCommandEvent& event ) // Generate the drill map of the board -void DIALOG_GENDRILL::GenDrillMap( const wxString aFileName, +void DIALOG_GENDRILL::GenDrillMap( const wxString aFullFileNameWithoutExt, EXCELLON_WRITER& aExcellonWriter, PlotFormat format ) { @@ -574,11 +575,9 @@ void DIALOG_GENDRILL::GenDrillMap( const wxString aFileName, return; } - /* Init file name */ - wxFileName fn = aFileName; - fn.SetName( fn.GetName() + wxT( "-drl_map" ) ); - fn.SetExt( ext ); - wxString fullFilename = fn.GetFullPath(); + // Add file name extension + wxString fullFilename = aFullFileNameWithoutExt; + fullFilename << wxT(".") << ext; bool success = aExcellonWriter.GenDrillMapFile( fullFilename, m_parent->GetPageSettings(), diff --git a/pcbnew/gendrill_Excellon_writer.h b/pcbnew/gendrill_Excellon_writer.h index 0803066f44..4ca739c453 100644 --- a/pcbnew/gendrill_Excellon_writer.h +++ b/pcbnew/gendrill_Excellon_writer.h @@ -228,11 +228,12 @@ public: EXCELLON_WRITER( BOARD* aPcb, wxPoint aOffset ) /** * Function GenDrillMapFile * Plot a map of drill marks for holes. - * @param aFullFileName : the name of this file (to plot it) + * @param aFullFileNameWithoutExt : the full filename of the file to create, + * without extension (will be added accordint ti the format) * @param aSheet : the paper sheet touse for plot * @param aFormat : one of the supported plot formats (see enum PlotFormat ) */ - bool GenDrillMapFile( const wxString& aFullFileName, + bool GenDrillMapFile( const wxString& aFullFileNameWithoutExt, const PAGE_INFO& aSheet, PlotFormat aFormat ); private: