Skip to content

Commit e04bca7

Browse files
committed
fix: mcpp auto-resolves xpkg from global xlings, remove all CI workarounds
When xlings installs a toolchain, the payload may land in xlings' global data dir instead of mcpp's sandbox. package_fetcher now checks ~/.xlings/data/xpkgs/ as fallback and copies automatically. Removed from CI/release: - xlings install llvm (mcpp handles it) - Pre-seed cp -r of LLVM xpkgs (mcpp handles it) mcpp now works like a real user: just `xlings install mcpp` then `mcpp build`.
1 parent 763ac63 commit e04bca7

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

src/pm/package_fetcher.cppm

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,28 @@ Fetcher::resolve_xpkg_path(std::string_view target,
605605
};
606606

607607
auto resolve = [&]() -> std::expected<XpkgPayload, CallError> {
608+
// xlings may install the package into its global home rather than
609+
// the mcpp sandbox. If the expected path is missing, copy from the
610+
// global xlings data directory.
611+
if (!std::filesystem::exists(verdir)) {
612+
auto xhome = std::getenv("HOME");
613+
#if defined(_WIN32)
614+
if (!xhome) xhome = std::getenv("USERPROFILE");
615+
#endif
616+
if (xhome) {
617+
auto globalDir = std::filesystem::path(xhome)
618+
/ ".xlings" / "data" / "xpkgs"
619+
/ verdir.parent_path().filename()
620+
/ verdir.filename();
621+
std::error_code ec;
622+
if (std::filesystem::exists(globalDir, ec)) {
623+
std::filesystem::create_directories(verdir.parent_path(), ec);
624+
std::filesystem::copy(globalDir, verdir,
625+
std::filesystem::copy_options::recursive
626+
| std::filesystem::copy_options::overwrite_existing, ec);
627+
}
628+
}
629+
}
608630
if (!std::filesystem::exists(verdir)) {
609631
// xlings may have installed the package into its own global home
610632
// rather than the mcpp sandbox. Try to copy it from the global

0 commit comments

Comments
 (0)