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

(cherry picked from commit 288982b15d)
This commit is contained in:
Wayne Stambaugh 2019-06-25 08:36:32 -04:00
parent 3bf7ab910f
commit df3a57dcda
2 changed files with 6 additions and 2 deletions

View File

@ -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 );

View File

@ -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 );