From 6b6057b194617a72cb0debf5cc5f5adeafacfcf0 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 3 Jul 2024 00:00:26 +0100 Subject: [PATCH] Clean up more exception processing in simulation GUI. This allows us to more correctly report errors without dialog issues, logs popping up, etc. Fixes https://gitlab.com/kicad/code/kicad/-/issues/18472 7f6ab7043b97535b37013edb5142bc0e2b07d6b9 from master --- common/common.cpp | 7 +- common/widgets/wx_infobar.cpp | 5 +- eeschema/dialogs/dialog_sim_model.cpp | 90 +++++++++--------- eeschema/dialogs/dialog_sim_model.h | 6 +- eeschema/dialogs/dialog_sim_model_base.cpp | 10 +- eeschema/dialogs/dialog_sim_model_base.fbp | 99 ++++++++++++++++---- eeschema/dialogs/dialog_sim_model_base.h | 10 +- eeschema/sim/sim_lib_mgr.cpp | 104 +++++++++------------ eeschema/sim/sim_lib_mgr.h | 6 +- eeschema/sim/sim_library.cpp | 2 +- eeschema/sim/sim_library.h | 4 +- eeschema/sim/sim_model_kibis.cpp | 7 +- eeschema/sim/spice_library_parser.cpp | 10 +- 13 files changed, 210 insertions(+), 150 deletions(-) diff --git a/common/common.cpp b/common/common.cpp index cbe636b03d..eef9883b36 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -147,7 +147,8 @@ wxString KIwxExpandEnvVars( const wxString& str, const PROJECT* aProject, std::s wxString strResult; strResult.Alloc( strlen ); // best guess (improves performance) - auto getVersionedEnvVar = []( const wxString& aMatch, wxString& aResult ) -> bool + auto getVersionedEnvVar = + []( const wxString& aMatch, wxString& aResult ) -> bool { for ( const wxString& var : ENV_VAR::GetPredefinedEnvVars() ) { @@ -180,7 +181,9 @@ wxString KIwxExpandEnvVars( const wxString& str, const PROJECT* aProject, std::s Bracket bracket; #ifdef __WINDOWS__ if( str_n == wxT( '%' ) ) - bracket = Bracket_Windows; + { + bracket = Bracket_Windows; + } else #endif // __WINDOWS__ if( n == strlen - 1 ) diff --git a/common/widgets/wx_infobar.cpp b/common/widgets/wx_infobar.cpp index 30c8575c91..5ae8a2828f 100644 --- a/common/widgets/wx_infobar.cpp +++ b/common/widgets/wx_infobar.cpp @@ -159,7 +159,10 @@ void WX_INFOBAR::ShowMessage( const wxString& aMessage, int aFlags ) m_updateLock = true; - wxInfoBarGeneric::ShowMessage( aMessage, aFlags ); + wxString msg = aMessage; + msg.Trim(); + + wxInfoBarGeneric::ShowMessage( msg, aFlags ); if( m_auiManager ) updateAuiLayout( true ); diff --git a/eeschema/dialogs/dialog_sim_model.cpp b/eeschema/dialogs/dialog_sim_model.cpp index 15ff4e35de..1396bc50b2 100644 --- a/eeschema/dialogs/dialog_sim_model.cpp +++ b/eeschema/dialogs/dialog_sim_model.cpp @@ -46,6 +46,7 @@ #include #include #include +#include using CATEGORY = SIM_MODEL::PARAM::CATEGORY; @@ -77,8 +78,7 @@ DIALOG_SIM_MODEL::DIALOG_SIM_MODEL( wxWindow* aParent, EDA_BA m_scintillaTricksSubckt( nullptr ), m_firstCategory( nullptr ), m_prevParamGridSelection( nullptr ), - m_lastParamGridWidth( 0 ), - m_inKillFocus( false ) + m_lastParamGridWidth( 0 ) { m_browseButton->SetBitmap( KiBitmapBundle( BITMAPS::small_folder ) ); @@ -219,12 +219,14 @@ bool DIALOG_SIM_MODEL::TransferDataToWindow() // The model is sourced from a library, optionally with instance overrides. m_rbLibraryModel->SetValue( true ); - if( !loadLibrary( libraryFilename ) ) + if( !loadLibrary( libraryFilename, reporter ) ) { + if( reporter.HasMessage() ) + m_infoBar->ShowMessage( msg ); + m_libraryPathText->ChangeValue( libraryFilename ); m_curModelType = SIM_MODEL::ReadTypeFromFields( m_fields, reporter ); - // load library will mangle the set reporter m_libraryModelsMgr.CreateModel( nullptr, m_sortedPartPins, m_fields, reporter ); m_modelNameChoice->Append( _( "" ) ); @@ -237,14 +239,15 @@ bool DIALOG_SIM_MODEL::TransferDataToWindow() if( modelIdx == wxNOT_FOUND ) { - DisplayErrorMessage( this, wxString::Format( _( "No model named '%s' in library." ), - modelName ) ); + m_infoBar->ShowMessage( wxString::Format( _( "No model named '%s' in library." ), + modelName ) ); // Default to first item in library m_modelNameChoice->SetSelection( 0 ); } else { + m_infoBar->Hide(); m_modelNameChoice->SetSelection( modelIdx ); } @@ -807,37 +810,28 @@ void DIALOG_SIM_MODEL::removeOrphanedPinAssignments( SIM_MODE template -bool DIALOG_SIM_MODEL::loadLibrary( const wxString& aLibraryPath, - bool aForceReload ) +bool DIALOG_SIM_MODEL::loadLibrary( const wxString& aLibraryPath, REPORTER& aReporter, + bool aForceReload ) { if( m_prevLibrary == aLibraryPath && !aForceReload ) return true; - wxString msg; - WX_STRING_REPORTER reporter( &msg ); - m_libraryModelsMgr.SetForceFullParse(); - m_libraryModelsMgr.SetLibrary( aLibraryPath, reporter ); + m_libraryModelsMgr.SetLibrary( aLibraryPath, aReporter ); - if( reporter.HasMessage() ) - { - DisplayErrorMessage( this, msg ); + if( aReporter.HasMessage() ) return false; - } std::string modelName = SIM_MODEL::GetFieldValue( &m_fields, SIM_LIBRARY::NAME_FIELD ); for( const auto& [baseModelName, baseModel] : library()->GetModels() ) { if( baseModelName == modelName ) - m_libraryModelsMgr.CreateModel( &baseModel, m_sortedPartPins, m_fields, reporter ); + m_libraryModelsMgr.CreateModel( &baseModel, m_sortedPartPins, m_fields, aReporter ); else - m_libraryModelsMgr.CreateModel( &baseModel, m_sortedPartPins, reporter ); + m_libraryModelsMgr.CreateModel( &baseModel, m_sortedPartPins, aReporter ); } - if( reporter.HasMessage() ) - DisplayErrorMessage( this, msg ); - m_rbLibraryModel->SetValue( true ); m_libraryPathText->ChangeValue( aLibraryPath ); @@ -1178,22 +1172,7 @@ void DIALOG_SIM_MODEL::onRadioButton( wxCommandEvent& aEvent template void DIALOG_SIM_MODEL::onLibraryPathText( wxCommandEvent& aEvent ) { - if( m_rbLibraryModel->GetValue() ) - { - wxString path = m_libraryPathText->GetValue(); - - if( loadLibrary( path, true ) ) - { - try - { - updateWidgets(); - } - catch( const IO_ERROR& ) - { - // TODO: Add an infobar to report the error? - } - } - } + m_rbLibraryModel->SetValue( true ); } @@ -1201,21 +1180,33 @@ template void DIALOG_SIM_MODEL::onLibraryPathTextEnter( wxCommandEvent& aEvent ) { m_rbLibraryModel->SetValue( true ); + + wxString msg; + WX_STRING_REPORTER reporter( &msg ); + wxString path = m_libraryPathText->GetValue(); + + if( loadLibrary( path, reporter, true ) ) + m_infoBar->Hide(); + else if( reporter.HasMessage() ) + m_infoBar->ShowMessage( msg ); + + updateWidgets(); } template void DIALOG_SIM_MODEL::onLibraryPathTextKillFocus( wxFocusEvent& aEvent ) { - if( !m_inKillFocus ) - { - m_inKillFocus = true; + CallAfter( + [this]() + { + // Disable logging -- otherwise we'll end up in an endless loop of show-log, + // kill-focus, show-log, kill-focus, etc. + wxLogNull doNotLog; - wxCommandEvent dummy; - onLibraryPathTextEnter( dummy ); - - m_inKillFocus = false; - } + wxCommandEvent dummy; + onLibraryPathTextEnter( dummy ); + } ); aEvent.Skip(); // mandatory in wxFocusEvent events } @@ -1242,7 +1233,14 @@ void DIALOG_SIM_MODEL::onBrowseButtonClick( wxCommandEvent& a if( fn.MakeRelativeTo( Prj().GetProjectPath() ) && !fn.GetFullPath().StartsWith( wxS( ".." ) ) ) path = fn.GetFullPath(); - loadLibrary( path, true ); + wxString msg; + WX_STRING_REPORTER reporter( &msg ); + + if( loadLibrary( path, reporter, true ) ) + m_infoBar->Hide(); + else + m_infoBar->ShowMessage( msg ); + updateWidgets(); } diff --git a/eeschema/dialogs/dialog_sim_model.h b/eeschema/dialogs/dialog_sim_model.h index 4f544e27f5..60dc3840c2 100644 --- a/eeschema/dialogs/dialog_sim_model.h +++ b/eeschema/dialogs/dialog_sim_model.h @@ -79,7 +79,8 @@ private: void removeOrphanedPinAssignments( SIM_MODEL* aModel ); - bool loadLibrary( const wxString& aLibraryPath, bool aForceReload = false ); + bool loadLibrary( const wxString& aLibraryPath, REPORTER& aReporter, + bool aForceReload = false ); void addParamPropertyIfRelevant( SIM_MODEL* aModel, int aParamIndex ); wxPGProperty* newParamProperty( SIM_MODEL* aModel, int aParamIndex ) const; @@ -140,8 +141,7 @@ private: wxPGProperty* m_firstCategory; // Used to add principal parameters to root. wxPGProperty* m_prevParamGridSelection; - int m_lastParamGridWidth; - bool m_inKillFocus; + int m_lastParamGridWidth; }; #endif /* DIALOG_SIM_MODEL_H */ diff --git a/eeschema/dialogs/dialog_sim_model_base.cpp b/eeschema/dialogs/dialog_sim_model_base.cpp index 0462948050..c16b49fe13 100644 --- a/eeschema/dialogs/dialog_sim_model_base.cpp +++ b/eeschema/dialogs/dialog_sim_model_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) +// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -7,6 +7,7 @@ #include "widgets/std_bitmap_button.h" #include "widgets/wx_grid.h" +#include "widgets/wx_infobar.h" #include "dialog_sim_model_base.h" @@ -19,6 +20,13 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c wxBoxSizer* bSizer8; bSizer8 = new wxBoxSizer( wxVERTICAL ); + m_infoBar = new WX_INFOBAR( this ); + m_infoBar->SetShowHideEffects( wxSHOW_EFFECT_NONE, wxSHOW_EFFECT_NONE ); + m_infoBar->SetEffectDuration( 500 ); + m_infoBar->Hide(); + + bSizer8->Add( m_infoBar, 0, wxEXPAND, 5 ); + m_notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); m_modelPanel = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizerPanel; diff --git a/eeschema/dialogs/dialog_sim_model_base.fbp b/eeschema/dialogs/dialog_sim_model_base.fbp index 677de0c066..ccb342c305 100644 --- a/eeschema/dialogs/dialog_sim_model_base.fbp +++ b/eeschema/dialogs/dialog_sim_model_base.fbp @@ -1,36 +1,34 @@ - + + ; C++ - ; - 1 - connect - none - - - 0 - 0 + 1 + source_name + 0 + 0 res UTF-8 + connect dialog_sim_model_base 1000 + none + + 1 - 1 - UI DIALOG_SIM_MODEL_BASE + . - 0 - source_name - 1 - 0 - source_name - - - 1 + 1 + 1 + 1 + 1 + UI + 0 + 0 0 - 0 0 wxAUI_MGR_DEFAULT @@ -64,6 +62,67 @@ bSizer8 wxVERTICAL none + + 5 + wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 500 + 1 + + 1 + + 0 + 1 + wxSHOW_EFFECT_NONE + wxID_ANY + + 0 + + + 0 + + 1 + m_infoBar + 1 + + + protected + 1 + + Resizable + 1 + wxSHOW_EFFECT_NONE + + WX_INFOBAR; widgets/wx_infobar.h; forward_declare + 0 + + + + + + 10 wxEXPAND|wxTOP|wxRIGHT|wxLEFT diff --git a/eeschema/dialogs/dialog_sim_model_base.h b/eeschema/dialogs/dialog_sim_model_base.h index b55964a1df..b509fe465a 100644 --- a/eeschema/dialogs/dialog_sim_model_base.h +++ b/eeschema/dialogs/dialog_sim_model_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) +// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -12,14 +12,16 @@ #include class STD_BITMAP_BUTTON; class WX_GRID; +class WX_INFOBAR; #include "dialog_shim.h" -#include -#include +#include #include #include #include #include +#include +#include #include #include #include @@ -43,6 +45,7 @@ class WX_GRID; /////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////// /// Class DIALOG_SIM_MODEL_BASE /////////////////////////////////////////////////////////////////////////////// @@ -51,6 +54,7 @@ class DIALOG_SIM_MODEL_BASE : public DIALOG_SHIM private: protected: + WX_INFOBAR* m_infoBar; wxNotebook* m_notebook; wxPanel* m_modelPanel; wxRadioButton* m_rbLibraryModel; diff --git a/eeschema/sim/sim_lib_mgr.cpp b/eeschema/sim/sim_lib_mgr.cpp index e9c9458d66..1b00b5b82c 100644 --- a/eeschema/sim/sim_lib_mgr.cpp +++ b/eeschema/sim/sim_lib_mgr.cpp @@ -53,7 +53,8 @@ void SIM_LIB_MGR::Clear() } -wxString SIM_LIB_MGR::ResolveLibraryPath( const wxString& aLibraryPath, const PROJECT* aProject ) +wxString SIM_LIB_MGR::ResolveLibraryPath( const wxString& aLibraryPath, const PROJECT* aProject, + REPORTER& aReporter ) { wxString expandedPath = ExpandEnvVarSubstitutions( aLibraryPath, aProject ); @@ -80,20 +81,23 @@ wxString SIM_LIB_MGR::ResolveLibraryPath( const wxString& aLibraryPath, const PR if( spiceLibDir.IsEmpty() || spiceLibFn.GetFullPath() == projectFn.GetFullPath() ) { - THROW_IO_ERROR( wxString::Format( _( "Simulation model library not found at '%s'" ), - projectFn.GetFullPath() ) ); + aReporter.Report( wxString::Format( _( "Simulation model library not found at '%s'" ), + projectFn.GetFullPath() ) ); } else { - THROW_IO_ERROR( wxString::Format( _( "Simulation model library not found at '%s' or '%s'" ), - projectFn.GetFullPath(), - spiceLibFn.GetFullPath() ) ); + aReporter.Report( wxString::Format( _( "Simulation model library not found at '%s' or '%s'" ), + projectFn.GetFullPath(), + spiceLibFn.GetFullPath() ) ); } + + return aLibraryPath; } wxString SIM_LIB_MGR::ResolveEmbeddedLibraryPath( const wxString& aLibPath, - const wxString& aRelativeLib ) + const wxString& aRelativeLib, + REPORTER& aReporter ) { wxFileName testPath( aLibPath ); wxString fullPath( aLibPath ); @@ -102,12 +106,7 @@ wxString SIM_LIB_MGR::ResolveEmbeddedLibraryPath( const wxString& aLibPath, { wxString relLib( aRelativeLib ); - try - { - relLib = ResolveLibraryPath( relLib, m_project ); - } - catch( ... ) - {} + relLib = ResolveLibraryPath( relLib, m_project, aReporter ); wxFileName fn( relLib ); @@ -115,17 +114,12 @@ wxString SIM_LIB_MGR::ResolveEmbeddedLibraryPath( const wxString& aLibPath, fullPath = testPath.GetFullPath(); } - try - { - wxFileName fn( fullPath ); + wxFileName fn( fullPath ); - if( !fn.Exists() ) - fullPath = aLibPath; + if( !fn.Exists() ) + fullPath = aLibPath; - fullPath = ResolveLibraryPath( fullPath, m_project ); - } - catch( ... ) - {} + fullPath = ResolveLibraryPath( fullPath, m_project, aReporter ); return fullPath; } @@ -133,23 +127,26 @@ wxString SIM_LIB_MGR::ResolveEmbeddedLibraryPath( const wxString& aLibPath, void SIM_LIB_MGR::SetLibrary( const wxString& aLibraryPath, REPORTER& aReporter ) { - try + wxString path = ResolveLibraryPath( aLibraryPath, m_project, aReporter ); + + if( aReporter.HasMessage() ) + return; + + if( !wxFileName::Exists( path ) ) { - wxString path = ResolveLibraryPath( aLibraryPath, m_project ); - - std::function f2 = - std::bind( &SIM_LIB_MGR::ResolveEmbeddedLibraryPath, this, _1, _2 ); - - std::unique_ptr library = SIM_LIBRARY::Create( path, m_forceFullParse, - aReporter, &f2 ); - - Clear(); - m_libraries[path] = std::move( library ); - } - catch( const IO_ERROR& e ) - { - aReporter.Report( e.What() ); + aReporter.Report( wxString::Format( _( "Simulation model library not found at '%s'" ), + path ) ); + return; } + + std::unique_ptr library = SIM_LIBRARY::Create( path, m_forceFullParse, aReporter, + [&]( const wxString& libPath, const wxString& relativeLib ) -> wxString + { + return ResolveEmbeddedLibraryPath( libPath, relativeLib, aReporter ); + } ); + + Clear(); + m_libraries[path] = std::move( library ); } @@ -299,37 +296,24 @@ SIM_LIBRARY::MODEL SIM_LIB_MGR::CreateModel( const wxString& aLibraryPath, const std::vector& aPins, REPORTER& aReporter ) { - wxString path; wxString msg; SIM_LIBRARY* library = nullptr; SIM_MODEL* baseModel = nullptr; std::string modelName; + wxString path = ResolveLibraryPath( aLibraryPath, m_project, aReporter ); - try + auto it = m_libraries.find( path ); + + if( it == m_libraries.end() ) { - path = ResolveLibraryPath( aLibraryPath, m_project ); - - auto it = m_libraries.find( path ); - - if( it == m_libraries.end() ) - { - std::function f2 = - std::bind( &SIM_LIB_MGR::ResolveEmbeddedLibraryPath, this, _1, _2 ); - - it = m_libraries.emplace( path, SIM_LIBRARY::Create( path, m_forceFullParse, - aReporter, &f2 ) ).first; - } - - library = &*it->second; + it = m_libraries.emplace( path, SIM_LIBRARY::Create( path, m_forceFullParse, aReporter, + [&]( const wxString& libPath, const wxString& relativeLib ) -> wxString + { + return ResolveEmbeddedLibraryPath( libPath, relativeLib, aReporter ); + } ) ).first; } - catch( const IO_ERROR& e ) - { - msg.Printf( _( "Error loading simulation model library '%s': %s" ), - path, - e.What() ); - aReporter.Report( msg, RPT_SEVERITY_ERROR ); - } + library = &*it->second; if( aBaseModelName == "" ) { diff --git a/eeschema/sim/sim_lib_mgr.h b/eeschema/sim/sim_lib_mgr.h index 06b53200c7..669fcacee9 100644 --- a/eeschema/sim/sim_lib_mgr.h +++ b/eeschema/sim/sim_lib_mgr.h @@ -79,8 +79,10 @@ public: std::map> GetLibraries() const; std::vector> GetModels() const; - static wxString ResolveLibraryPath( const wxString& aLibraryPath, const PROJECT* aProject ); - wxString ResolveEmbeddedLibraryPath( const wxString& aLibPath, const wxString& aRelativeLib ); + static wxString ResolveLibraryPath( const wxString& aLibraryPath, const PROJECT* aProject, + REPORTER& aReporter ); + wxString ResolveEmbeddedLibraryPath( const wxString& aLibPath, const wxString& aRelativeLib, + REPORTER& aReporter ); private: const PROJECT* m_project; diff --git a/eeschema/sim/sim_library.cpp b/eeschema/sim/sim_library.cpp index a6ec979b27..65797730f4 100644 --- a/eeschema/sim/sim_library.cpp +++ b/eeschema/sim/sim_library.cpp @@ -31,7 +31,7 @@ std::unique_ptr SIM_LIBRARY::Create( const wxString& aFilePath, bool aForceFullParse, REPORTER& aReporter, - std::function* aResolver ) + const std::function& aResolver ) { std::unique_ptr library; diff --git a/eeschema/sim/sim_library.h b/eeschema/sim/sim_library.h index d0e6177899..2989bf813c 100644 --- a/eeschema/sim/sim_library.h +++ b/eeschema/sim/sim_library.h @@ -56,7 +56,7 @@ public: */ static std::unique_ptr Create( const wxString& aFilePath, bool aForceFullParse, REPORTER& aReporter, - std::function* aResolver ); + const std::function& aResolver ); /** * Read library from a source file. Must be in the format appropriate to the subclass, e.g. @@ -77,7 +77,7 @@ protected: std::vector m_modelNames; std::vector> m_models; - std::function* m_pathResolver; + std::function m_pathResolver; std::string m_filePath; }; diff --git a/eeschema/sim/sim_model_kibis.cpp b/eeschema/sim/sim_model_kibis.cpp index daaabba1bf..ca91d27a90 100644 --- a/eeschema/sim/sim_model_kibis.cpp +++ b/eeschema/sim/sim_model_kibis.cpp @@ -68,7 +68,12 @@ std::string SPICE_GENERATOR_KIBIS::IbisDevice( const SPICE_ITEM& aItem, const PR std::string ibisModelName = SIM_MODEL::GetFieldValue( &aItem.fields, SIM_LIBRARY_KIBIS::MODEL_FIELD ); bool diffMode = SIM_MODEL::GetFieldValue( &aItem.fields, SIM_LIBRARY_KIBIS::DIFF_FIELD ) == "1"; - wxString path = SIM_LIB_MGR::ResolveLibraryPath( ibisLibFilename, &aProject ); + wxString msg; + WX_STRING_REPORTER reporter( &msg ); + wxString path = SIM_LIB_MGR::ResolveLibraryPath( ibisLibFilename, &aProject, reporter ); + + if( reporter.HasMessage() ) + THROW_IO_ERROR( msg ); KIBIS kibis( std::string( path.c_str() ) ); kibis.m_cacheDir = std::string( aCacheDir.c_str() ); diff --git a/eeschema/sim/spice_library_parser.cpp b/eeschema/sim/spice_library_parser.cpp index 88839e48ac..cc73110ab6 100644 --- a/eeschema/sim/spice_library_parser.cpp +++ b/eeschema/sim/spice_library_parser.cpp @@ -118,10 +118,7 @@ void SPICE_LIBRARY_PARSER::readFallbacks( const wxString& aFilePath, REPORTER& a } else if( token == wxS( ".inc" ) ) { - wxString lib = tokenizer.GetNextToken(); - - if( m_library.m_pathResolver ) - lib = ( *m_library.m_pathResolver )( lib, aFilePath ); + wxString lib = m_library.m_pathResolver( tokenizer.GetNextToken(), aFilePath ); parseFile( lib, aReporter ); } @@ -170,13 +167,10 @@ void SPICE_LIBRARY_PARSER::parseFile( const wxString &aFilePath, REPORTER& aRepo } else if( node->is_type() ) { - wxString lib = node->children.at( 0 )->string(); + wxString lib = m_library.m_pathResolver( node->children.at( 0 )->string(), aFilePath ); try { - if( m_library.m_pathResolver ) - lib = ( *m_library.m_pathResolver )( lib, aFilePath ); - parseFile( lib, aReporter ); } catch( const IO_ERROR& e )