Fix bug when adding symbol library with $ as first character of path name.

Test the result of wxFileName::MakeRelativeTo() before testing to see if
the resulting relative path starts with '.'.  When a library with relative
path that contains a path name with $ as the first character,
MakeRelativeTo() calls Normalize() which attempts to do an environment
variable substitution that concatenates consecutive paths i.e. the path
/foo/$bar ends up being foo$bar which is obviously incorrect.  This fix
is only a fix for absolute paths and files that contain path names that
begin with $.  This still does not resolve the issue when adding a
library file relative to one of the search paths that contains a path
name that begins with a $.  Fixing this would potentially break paths
that are expecting environment variable substitution.

Fixes lp:1712361

https://bugs.launchpad.net/kicad/+bug/1712361
This commit is contained in:
Wayne Stambaugh 2017-08-24 11:17:40 -04:00
parent 7ce86e0da5
commit ee43728b18
1 changed files with 1 additions and 2 deletions

View File

@ -348,9 +348,8 @@ void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
for( unsigned ll = 0; ll < paths.GetCount(); ll++ ) for( unsigned ll = 0; ll < paths.GetCount(); ll++ )
{ {
wxFileName relfn = fn; wxFileName relfn = fn;
relfn.MakeRelativeTo( paths[ll] );
if( relfn.GetPath()[0] != '.' ) if( relfn.MakeRelativeTo( paths[ll] ) && relfn.GetPath()[0] != '.' )
{ {
fn = relfn; fn = relfn;
break; break;