Skip to content

Commit e5e39de

Browse files
committed
fix: install_path fallback for default namespace with xlings layout
When kDefaultNamespace changed to "mcpplibs", qualified_name() returns just the bare shortName for default-ns packages. But xlings always installs with the full "ns.shortName" directory name. Add a fallback that tries <index>-x-<ns>.<shortName> for default-ns packages too.
1 parent 7251ca7 commit e5e39de

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

src/pm/compat.cppm

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,20 +169,29 @@ inline std::vector<std::string> install_dir_candidates(std::string_view ns,
169169
{
170170
std::vector<std::string> candidates;
171171
auto qname = qualified_name(ns, shortName);
172+
auto fqname = ns.empty() ? std::string(shortName)
173+
: std::format("{}.{}", ns, shortName);
172174

173175
// Canonical: <index>-x-<ns>.<shortName> (e.g. "mcpp-index-x-compat.mbedtls")
174-
// For default namespace: <index>-x-<shortName> (e.g. "mcpp-index-x-gtest")
176+
// For default namespace: <index>-x-<shortName> (e.g. "mcpp-index-x-cmdline")
175177
candidates.push_back(std::format("{}-x-{}", indexName, qname));
176178

179+
// Fallback: xlings always installs with the full qualified name
180+
// (ns.shortName), even for the default namespace. So we also try
181+
// <index>-x-<ns>.<shortName> when qname != fqname.
182+
if (qname != fqname) {
183+
candidates.push_back(std::format("{}-x-{}", indexName, fqname));
184+
}
185+
177186
// ── Fallback candidates (COMPAT, remove in 1.0.0) ──────────────
178187

179-
// Fallback 1: namespace-prefixed dir without index
188+
// Namespace-prefixed dir without index
180189
// e.g. "compat-x-mbedtls" (new-style ns-aware layout)
181190
if (!ns.empty() && ns != mcpp::pm::kDefaultNamespace) {
182191
candidates.push_back(std::format("{}-x-{}", ns, shortName));
183192
}
184193

185-
// Fallback 2: index-prefixed with bare short name
194+
// Index-prefixed with bare short name
186195
// e.g. "mcpp-index-x-mbedtls" (old pre-namespace layout)
187196
if (!ns.empty() && ns != mcpp::pm::kDefaultNamespace) {
188197
candidates.push_back(std::format("{}-x-{}", indexName, shortName));

0 commit comments

Comments
 (0)