Commit Graph

2 Commits

Author SHA1 Message Date
Seth Hillbrand 67c570b99b Fix stale top_level_sheets references after template project copy
When a project is created from a template, PROJECT_TEMPLATE::CreateProject()
renames files on disk (e.g., default.kicad_sch -> newproject.kicad_sch) but
does not update the .kicad_pro file content. This leaves the top_level_sheets
entries referencing the template's filenames, causing "Top level sheet not
found" errors when the new project is opened.

Add a fixup step in PROJECT_FILE::LoadFromFile() that detects stale
top_level_sheets references by checking whether the referenced schematic
files exist on disk. When a referenced file is missing but a file matching
the project name exists, the reference is updated to point to the correct
file.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/22951
2026-02-13 11:13:38 -08:00
Seth Hillbrand 76f8b5dd2a Update root sheet display name during project SaveAs
When performing a project SaveAs, the root sheet's display name (shown
in the hierarchy navigator panel) was not being updated to match the
new project name, even though the filename was correctly renamed.

The fix adds a check in PROJECT_FILE::SaveAs to update the sheet name
when it matches the old project name. This ensures the hierarchy panel
reflects the correct project name after a SaveAs operation.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/22853
2026-01-26 16:00:08 -08:00