From bf44d394c35c23c8b319339719d26dc2ab5ee892 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Wed, 3 Jan 2018 08:37:54 -0500 Subject: [PATCH] Eeschema: fix remapping bug on windows builds. The Windows drive specifier C: was being interpreted as a valid URL by wxURI which was performing a URL comparison instead of a file comparison which always failed in LIB_TABLE_BASE::FindRowByURI(). Change test for URI to search string for "://" to determine if the comparison should be a URI (string) comparison or a file (wxFileName) comparison. Don't run final rescue unless the user performs the remapping. --- common/lib_table_base.cpp | 4 +--- eeschema/dialogs/dialog_symbol_remap.cpp | 9 +++++++++ eeschema/files-io.cpp | 5 ----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/common/lib_table_base.cpp b/common/lib_table_base.cpp index 81610ee4ad..128bec2da8 100644 --- a/common/lib_table_base.cpp +++ b/common/lib_table_base.cpp @@ -338,9 +338,7 @@ const LIB_TABLE_ROW* LIB_TABLE::FindRowByURI( const wxString& aURI ) { wxString tmp = cur->rows[i].GetFullURI( true ); - wxURI uri( tmp ); - - if( uri.HasScheme() ) + if( tmp.Find( "://" ) != wxNOT_FOUND ) { if( tmp == aURI ) return &cur->rows[i]; // found as URI diff --git a/eeschema/dialogs/dialog_symbol_remap.cpp b/eeschema/dialogs/dialog_symbol_remap.cpp index 4fd649c704..88c91f5846 100644 --- a/eeschema/dialogs/dialog_symbol_remap.cpp +++ b/eeschema/dialogs/dialog_symbol_remap.cpp @@ -64,10 +64,19 @@ DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP( SCH_EDIT_FRAME* aParent ) : void DIALOG_SYMBOL_REMAP::OnRemapSymbols( wxCommandEvent& aEvent ) { + SCH_EDIT_FRAME* parent = dynamic_cast< SCH_EDIT_FRAME* >( GetParent() ); + + wxCHECK_RET( parent != nullptr, "Parent window is not type SCH_EDIT_FRAME." ); + wxBusyCursor busy; backupProject(); + // Ignore the never show rescue setting for one last rescue of legacy symbol + // libraries before remapping to the symbol library table. This ensures the + // best remapping results. + parent->RescueLegacyProject( false ); + // The schematic is fully loaded, any legacy library symbols have been rescued. Now // check to see if the schematic has not been converted to the symbol library table // method for looking up symbols. diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index 31d8d0e1e6..e334313232 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -343,11 +343,6 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in // Convert old projects over to use symbol library table. if( schematic.HasNoFullyDefinedLibIds() ) { - // Ignore the never show rescue setting for one last rescue of legacy symbol - // libraries before remapping to the symbol library table. This ensures the - // best remapping results. - RescueLegacyProject( false ); - DIALOG_SYMBOL_REMAP dlgRemap( this ); dlgRemap.ShowQuasiModal();