KiCad: fix new project from template bug.

Do no rename symbol library files to the new project name.  Only rename
the cache library.  This prevents breaking symbol library links in the
schematic due to the project symbol library table pointing to the wrong
library file name.

Fixes lp:1837667

https://bugs.launchpad.net/kicad/+bug/1837667
This commit is contained in:
Wayne Stambaugh 2019-08-07 15:37:17 -04:00
parent 8b3e257648
commit c7fc54b348
1 changed files with 8 additions and 2 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Brian Sidebotham <brian.sidebotham@gmail.com>
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -180,7 +180,13 @@ bool PROJECT_TEMPLATE::CreateProject( wxFileName& aNewProjectPath, wxString* aEr
// Replace the template filename with the project filename for the new project creation
wxString currname = destination.GetName();
currname.Replace( basename, aNewProjectPath.GetName() );
// Do not rename project specific symbol libraries. This will break the symbol library
// table which will cause broken symbol library links in the schematic.
if( !( destination.GetExt() == "dcm"
|| ( destination.GetExt() == "lib" && !destination.GetName().EndsWith( "-cache" ) ) ) )
currname.Replace( basename, aNewProjectPath.GetName() );
destination.SetName( currname );
// Replace the template path with the project path for the new project creation