59 BOOST_REQUIRE_MESSAGE( std::filesystem::exists( sourceBoard ),
"Missing test board " << sourceBoard );
63 const size_t originalCount = board->Footprints().size();
69 const std::filesystem::path& onDisk = workDir.
Path() /
"panel.kicad_pcb";
71 const wxString onDiskPath = wxString::FromUTF8( onDisk.string() );
75 std::filesystem::path projectFile = onDisk;
76 projectFile.replace_extension(
".kicad_pro" );
79 std::ofstream
project( projectFile );
81 project <<
"{ \"meta\": { \"version\": 1 } }\n";
85 while( board->Footprints().size() > 1 )
86 board->Remove( board->Footprints().back() );
88 const size_t remainingCount = board->Footprints().size();
93 std::vector<wxString> tempFiles;
95 const wxString error =
100 BOOST_CHECK_MESSAGE( inputPath != onDiskPath,
"Modified board must stage a temporary copy, not the on-disk file" );
109 std::filesystem::path stagedProject = std::filesystem::path( std::string( inputPath.utf8_str() ) );
110 stagedProject.replace_extension(
".kicad_pro" );
111 BOOST_CHECK( std::filesystem::exists( stagedProject ) );
112 BOOST_CHECK_EQUAL( std::filesystem::file_size( stagedProject ), std::filesystem::file_size( projectFile ) );
119 for(
const wxString& f : tempFiles )
121 if( wxFileExists( f ) )
136 const wxString onDiskPath = wxString::FromUTF8( sourceBoard );
139 std::vector<wxString> tempFiles;
140 wxString errorDetail;
142 tempFiles, errorDetail );
static wxString StageBoardForExport(const wxString &aBoardPath, bool aContentModified, BOARD *aBoard, wxString &aInputPath, std::vector< wxString > &aTempFiles, wxString &aErrorDetail)
Resolve the board file to hand to the external 3D/STEP exporter.
std::unique_ptr< BOARD > ReadBoardFromFileOrStream(const std::string &aFilename, std::istream &aFallback)
Read a board from a file, or another stream, as appropriate.