From 288982b15d77d19f46ee727891aa92b4a58a69f8 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Tue, 25 Jun 2019 08:36:32 -0400 Subject: [PATCH] Symbol and footprint library table editor fix. Prevent the symbol and footprint library table editors from substituting the current project path (${KIPRJMOD}) when adding libraries to the global library table. This will almost assuredly fail when opening a different project. We still allow users to manually use ${KIPRJMOD} in global table paths under the assumption that if they are typing this in then they most likely understand environment variable substitution. Fixes lp:1830694 https://bugs.launchpad.net/kicad/+bug/1830694 --- eeschema/dialogs/panel_sym_lib_table.cpp | 4 +++- pcbnew/dialogs/panel_fp_lib_table.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/eeschema/dialogs/panel_sym_lib_table.cpp b/eeschema/dialogs/panel_sym_lib_table.cpp index 526cf89c52..845548849a 100644 --- a/eeschema/dialogs/panel_sym_lib_table.cpp +++ b/eeschema/dialogs/panel_sym_lib_table.cpp @@ -414,7 +414,9 @@ void PANEL_SYM_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event ) // try to use path normalized to an environmental variable or project path wxString path = NormalizePath( filePath, &envVars, m_projectBasePath ); - if( path.IsEmpty() ) + // Do not use the project path in the global library table. This will almost + // assuredly be wrong for a different project. + if( path.IsEmpty() || (m_pageNdx == 0 && path.Contains( "${KIPRJMOD}" )) ) path = fn.GetFullPath(); m_cur_grid->SetCellValue( last_row, COL_URI, path ); diff --git a/pcbnew/dialogs/panel_fp_lib_table.cpp b/pcbnew/dialogs/panel_fp_lib_table.cpp index a2811d487a..0b23eefd12 100644 --- a/pcbnew/dialogs/panel_fp_lib_table.cpp +++ b/pcbnew/dialogs/panel_fp_lib_table.cpp @@ -667,7 +667,9 @@ void PANEL_FP_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event ) // try to use path normalized to an environmental variable or project path wxString path = NormalizePath( filePath, &envVars, m_projectBasePath ); - if( path.IsEmpty() ) + // Do not use the project path in the global library table. This will almost + // assuredly be wrong for a different project. + if( path.IsEmpty() || (m_pageNdx == 0 && path.Contains( "${KIPRJMOD}" )) ) path = fn.GetFullPath(); m_cur_grid->SetCellValue( last_row, COL_URI, path );