Resolve the trusted system temporary path in career file fixtures (by Codex)

This commit is contained in:
Codex committed 2026-10-29 17:53:55 +01:00
1 parent 0842cb3458
commit 2ce563a4b9
1 file changed
+3 -1
+3 -1
View File
@@ -8,7 +8,9 @@ namespace {
void require(bool ok,const char *why){if(!ok)throw std::runtime_error(why);}
template<class F> void rejected(F f,const char *why){bool caught=false;try{f();}catch(const std::exception&){caught=true;}require(caught,why);}
struct Fixture {
fs::path root=fs::temp_directory_path()/("modern-career-files-"+std::to_string(std::chrono::steady_clock::now().time_since_epoch().count()));
// macOS exposes its temporary directory through the system /var alias.
// Resolve the trusted OS root; deliberate library/file links are still rejected below.
fs::path root=fs::canonical(fs::temp_directory_path())/("modern-career-files-"+std::to_string(std::chrono::steady_clock::now().time_since_epoch().count()));
Fixture(){fs::create_directories(root);}
~Fixture(){std::error_code e;fs::remove_all(root,e);}
};