From 74cc5a75a871bc7a147ddfb3b07cd1522add3832 Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Tue, 11 May 2010 09:35:13 -0500 Subject: [PATCH] fix Bug #578532, document and embellish QuoteFullPath() --- common/gestfich.cpp | 2 +- eeschema/schframe.cpp | 9 ++++++--- include/gestfich.h | 6 ++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/common/gestfich.cpp b/common/gestfich.cpp index ac2e1be03e..fa8427b0a2 100644 --- a/common/gestfich.cpp +++ b/common/gestfich.cpp @@ -685,5 +685,5 @@ void OpenFile( const wxString& file ) wxString QuoteFullPath( wxFileName& fn, wxPathFormat format ) { - return wxT( "\"" ) + fn.GetFullPath() + wxT( "\"" ); + return wxT( "\"" ) + fn.GetFullPath( format ) + wxT( "\"" ); } diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index 9de86402c6..ffea18eacc 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -458,7 +458,7 @@ wxString WinEDA_SchematicFrame::GetUniqueFilenameForCurrentSheet() #else fn.ClearExt(); wxString filename = fn.GetFullPath(); - if( ( filename.Len() + m_CurrentSheet->PathHumanReadable().Len() ) < 80 ) + if( ( filename.Len() + m_CurrentSheet->PathHumanReadable().Len() ) < 80 ) #endif { @@ -702,8 +702,11 @@ void WinEDA_SchematicFrame::OnOpenPcbnew( wxCommandEvent& event ) if( fn.IsOk() ) { - fn.ClearExt(); - ExecuteFile( this, PCBNEW_EXE, QuoteFullPath( fn ) ); + fn.SetExt( BoardFileExtension ); + + wxString filename = QuoteFullPath( fn ); + + ExecuteFile( this, PCBNEW_EXE, filename ); } else ExecuteFile( this, PCBNEW_EXE ); diff --git a/include/gestfich.h b/include/gestfich.h index cc74168794..65248402f4 100644 --- a/include/gestfich.h +++ b/include/gestfich.h @@ -77,8 +77,10 @@ wxString FindKicadFile( const wxString& shortname ); * Quote return value of wxFileName::GetFullPath(). * * This allows file name paths with spaces to be used as parameters to - * ProcessExecute function calls. This is a cheap and dirty hack and - * should probably should be done in a class derived from wxFileName. + * ProcessExecute function calls. + * @param fn is the filename to wrap + * @param format if provided, can be used to transform the nature of the + * wrapped filename to another platform. */ extern wxString QuoteFullPath( wxFileName& fn, wxPathFormat format = wxPATH_NATIVE );