75bool createSymlinkOrSkip(
const std::filesystem::path& aTarget,
const std::filesystem::path& aLink )
109 namespace fs = std::filesystem;
111 const ScratchRoot scratch(
"cycle" );
112 const wxString root = wxString::FromUTF8( scratch.path.string() );
114 std::ofstream( scratch.path /
"_autosave-board.kicad_pcb" ) <<
"x";
116 if( !createSymlinkOrSkip(
".", scratch.path /
"loop" ) )
119 std::vector<std::pair<wxString, wxString>> pairs =
122 BOOST_CHECK( anyEndsWith( pairs, wxS(
"_autosave-board.kicad_pcb" ) ) );
132 namespace fs = std::filesystem;
134 const ScratchRoot scratch(
"escape" );
135 const ScratchRoot outside(
"escape_outside" );
137 std::ofstream( scratch.path /
"_autosave-inside.kicad_pcb" ) <<
"x";
138 std::ofstream( outside.path /
"_autosave-outside.kicad_pcb" ) <<
"x";
140 const fs::path dosdevices = scratch.path /
"wineprefix" /
"dosdevices";
142 fs::create_directories( dosdevices, ec );
143 BOOST_REQUIRE_MESSAGE( !ec, ec.message() );
145 if( !createSymlinkOrSkip( outside.path, dosdevices /
"z:" ) )
148 const wxString root = wxString::FromUTF8( scratch.path.string() );
150 std::vector<std::pair<wxString, wxString>> pairs =
153 BOOST_CHECK( anyEndsWith( pairs, wxS(
"_autosave-inside.kicad_pcb" ) ) );
154 BOOST_CHECK( !anyEndsWith( pairs, wxS(
"_autosave-outside.kicad_pcb" ) ) );
static std::vector< std::pair< wxString, wxString > > CollectAutosaveFilePairs(const wxString &aAutosaveRoot, const wxString &aProjectPath, BACKUP_LOCATION aLocation)
Enumerate every (autosave, source) pair found under aAutosaveRoot for the project at aProjectPath,...
BOOST_AUTO_TEST_CASE(SelfReferencingSymlinkTerminates)