From 4df3ba6a5677a25cd2f3ff8116b6b5af7fc52388 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 12 Jul 2021 19:40:03 +0200 Subject: [PATCH] DIALOG_SPICE_MODEL: expand env var to open lib file selection dialog in the previous selected lib --- eeschema/dialogs/dialog_spice_model.cpp | 9 +++++++-- eeschema/dialogs/dialog_spice_model_base.fbp | 5 ----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/eeschema/dialogs/dialog_spice_model.cpp b/eeschema/dialogs/dialog_spice_model.cpp index 9905424157..78ea2549c2 100644 --- a/eeschema/dialogs/dialog_spice_model.cpp +++ b/eeschema/dialogs/dialog_spice_model.cpp @@ -839,7 +839,7 @@ void DIALOG_SPICE_MODEL::loadLibrary( const wxString& aFilePath ) { //First, expand env vars, if any wxString libname = ExpandEnvVarSubstitutions( aFilePath, &Prj() ); - // Add make path absolute, especially if relative to the project path + // Make path absolute, especially if it is relative to the project path libname = Prj().AbsolutePath( libname ); wxString curModel = m_modelName->GetValue(); @@ -1012,7 +1012,12 @@ bool DIALOG_SPICE_MODEL::addPwlValue( const wxString& aTime, const wxString& aVa void DIALOG_SPICE_MODEL::onSelectLibrary( wxCommandEvent& event ) { - wxString searchPath = wxFileName( m_modelLibrary->GetValue() ).GetPath(); + //First, expand env vars, if any, in lib path + wxString libname = ExpandEnvVarSubstitutions( m_modelLibrary->GetValue(), &Prj() ); + // Make path absolute, especially if it is relative to the project path + libname = Prj().AbsolutePath( libname ); + + wxString searchPath = wxFileName( libname ).GetPath(); if( searchPath.IsEmpty() ) searchPath = Prj().GetProjectPath(); diff --git a/eeschema/dialogs/dialog_spice_model_base.fbp b/eeschema/dialogs/dialog_spice_model_base.fbp index f04225deeb..dd4f7c3b84 100644 --- a/eeschema/dialogs/dialog_spice_model_base.fbp +++ b/eeschema/dialogs/dialog_spice_model_base.fbp @@ -14,7 +14,6 @@ dialog_spice_model_base 1000 none - 1 DIALOG_SPICE_MODEL_BASE @@ -26,7 +25,6 @@ 1 1 UI - 0 0 0 @@ -2651,7 +2649,6 @@ - 0 @@ -7939,7 +7936,6 @@ - 0 @@ -8075,7 +8071,6 @@ - 0