Skip to content

Child sheets are not copied when doing Save As on schematic/project

Description

When using Save As to create a copy of a schematic (or project) to a new location, any child hierarchical sheets are not copied. Instead, the new project will reference the old files using relative paths.

This behavior seems like it would usually be wrong and unexpected, at least for child sheets that are within the project directory.

I think we should change the behavior to copy child sheets that are within the project directory tree. Any externally-referenced sheets outside the project directory should continue to be not copied (instead updating the file path to the new relative path)

Steps to reproduce

  1. Open a hierarchical design in the schematic editor standalone
  2. File > Save As to a new location
  3. Observe

KiCad Version

Application: KiCad PCB Editor arm64 on arm64

Version: 9.0.4, release build

Libraries:
	wxWidgets 3.2.8
	FreeType 2.13.3
	HarfBuzz 10.1.0
	FontConfig 2.15.0

Platform: macOS Sonoma Version 14.4.1 (Build 23E224), 64 bit, Little endian, wxMac
OpenGL: Apple, Apple M1 Pro, 2.1 Metal - 88

	wxWidgets: 3.2.8 (wchar_t,wx containers)
	Boost: 1.87.0
	OCC: 7.8.1
	Curl: 8.7.1
	ngspice: 44.2
	Compiler: Clang 16.0.0 with C++ ABI 1002
	KICAD_IPC_API=ON