Eeschema: fix complex hierarchy file bug. (fixes lp:1605872)

* Add project path to sheet file name and extension so the test to see if a
  file is loaded by another sheet works correctly.
This commit is contained in:
Wayne Stambaugh 2016-07-24 20:52:40 -04:00
parent 146a78a8fb
commit 9c5e872a4f
1 changed files with 9 additions and 7 deletions

View File

@ -492,7 +492,15 @@ void SCH_LEGACY_PLUGIN::loadHierarchy( SCH_SHEET* aSheet )
if( !aSheet->GetScreen() )
{
m_rootSheet->SearchHierarchy( aSheet->GetFileName(), &screen );
// SCH_SCREEN objects store the full path and file name where the SCH_SHEET object only
// stores the file name and extension. Add the project path to the file name and
// extension to compare when calling SCH_SHEET::SearchHierarchy().
wxFileName fileName = aSheet->GetFileName();
if( !fileName.IsAbsolute() )
fileName.SetPath( m_path );
m_rootSheet->SearchHierarchy( fileName.GetFullPath(), &screen );
if( screen )
{
@ -503,12 +511,6 @@ void SCH_LEGACY_PLUGIN::loadHierarchy( SCH_SHEET* aSheet )
else
{
aSheet->SetScreen( new SCH_SCREEN( m_kiway ) );
wxFileName fileName = aSheet->GetFileName();
if( !fileName.IsAbsolute() )
fileName.SetPath( m_path );
aSheet->GetScreen()->SetFileName( fileName.GetFullPath() );
loadFile( fileName.GetFullPath(), aSheet->GetScreen() );