From 951e759fd1f39e625922030830c2fb758db0b2a6 Mon Sep 17 00:00:00 2001 From: dickelbeck Date: Wed, 20 Feb 2008 07:19:40 +0000 Subject: [PATCH] dodge some debug asserts in wxFileDialog which happen if the filename has a path --- pcbnew/specctra_export.cpp | 19 ++++++++++++------- pcbnew/specctra_import.cpp | 19 ++++++++++++------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/pcbnew/specctra_export.cpp b/pcbnew/specctra_export.cpp index ffc101d0ce..a62efede30 100644 --- a/pcbnew/specctra_export.cpp +++ b/pcbnew/specctra_export.cpp @@ -51,16 +51,21 @@ using namespace DSN; void WinEDA_PcbFrame::ExportToSpecctra( wxCommandEvent& event ) { wxString fullFileName = GetScreen()->m_FileName; - wxString std_ext = wxT( ".dsn" ); - wxString mask = wxT( "*" ) + std_ext; + wxString path; + wxString name; + wxString ext; - ChangeFileNameExt( fullFileName, std_ext ); + wxString dsn_ext = wxT( ".dsn" ); + wxString mask = wxT( "*" ) + dsn_ext; + + wxFileName::SplitPath( fullFileName, &path, &name, &ext ); + name += dsn_ext; fullFileName = EDA_FileSelector( _( "Specctra DSN file:" ), - wxEmptyString, /* Chemin par defaut */ - fullFileName, /* nom fichier par defaut */ - std_ext, /* extension par defaut */ - mask, /* Masque d'affichage */ + path, + name, // name.ext without path! + dsn_ext, + mask, this, wxFD_SAVE, FALSE diff --git a/pcbnew/specctra_import.cpp b/pcbnew/specctra_import.cpp index b19b96ecc4..ed522d8295 100644 --- a/pcbnew/specctra_import.cpp +++ b/pcbnew/specctra_import.cpp @@ -60,22 +60,27 @@ void WinEDA_PcbFrame::ImportSpecctraSession( wxCommandEvent& event ) } */ + wxString fullFileName = GetScreen()->m_FileName; + wxString path; + wxString name; + wxString ext; + wxString sessionExt( wxT( ".ses" ) ); - wxString fileName = GetScreen()->m_FileName; wxString mask = wxT( "*" ) + sessionExt; - ChangeFileNameExt( fileName, sessionExt ); + wxFileName::SplitPath( fullFileName, &path, &name, &ext ); + name += sessionExt; - fileName = EDA_FileSelector( _( "Merge Specctra Session file:" ), - wxEmptyString, - fileName, + fullFileName = EDA_FileSelector( _( "Merge Specctra Session file:" ), + path, + name, // name.ext without path! sessionExt, mask, this, wxFD_OPEN, FALSE ); - if( fileName == wxEmptyString ) + if( fullFileName == wxEmptyString ) return; SPECCTRA_DB db; @@ -84,7 +89,7 @@ void WinEDA_PcbFrame::ImportSpecctraSession( wxCommandEvent& event ) try { - db.LoadSESSION( fileName ); + db.LoadSESSION( fullFileName ); db.FromSESSION( m_Pcb ); } catch( IOError ioe )