Prefer relative paths.

This also prevents us from leaking private information into netlists
and PCBNew files.

Fixes https://gitlab.com/kicad/code/kicad/issues/6361
This commit is contained in:
Jeff Young 2020-11-15 15:11:41 +00:00
parent 6654c03041
commit 4e8072b8c2
1 changed files with 5 additions and 1 deletions

View File

@ -432,7 +432,11 @@ SCH_SHEET* SCH_SEXPR_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchema
{
// Clean up any allocated memory if an exception occurs loading the schematic.
std::unique_ptr<SCH_SHEET> newSheet = std::make_unique<SCH_SHEET>( aSchematic );
newSheet->SetFileName( aFileName );
wxFileName relPath( aFileName );
relPath.MakeRelativeTo( aSchematic->Prj().GetProjectPath(), wxPATH_UNIX );
newSheet->SetFileName( relPath.GetFullPath() );
m_rootSheet = newSheet.get();
loadHierarchy( newSheet.get() );