@@ -105,7 +105,7 @@ namespace cps::search {
105105 roots.emplace_back (" /usr" );
106106 roots.emplace_back (" /usr/local" );
107107
108- const std::vector<fs::path> segments{platform::libdir (), " share" };
108+ const std::vector<fs::path> segments{platform::libdir (env ), " share" };
109109 std::vector<fs::path> paths;
110110
111111 if (env.cps_path ) {
@@ -294,7 +294,7 @@ namespace cps::search {
294294 }
295295 }
296296
297- fs::path calculate_prefix (const fs::path & path, std::string_view name) {
297+ fs::path calculate_prefix (const fs::path & path, std::string_view name, const Env & env ) {
298298 // TODO: Windows
299299 // TODO: Mac
300300
@@ -319,7 +319,7 @@ namespace cps::search {
319319 }
320320 // Match only share or libdir, but not a potential odd situation
321321 // like `/opt/share/libdir/`
322- if (split.back () == " share" || split.back () == platform::libdir ()) {
322+ if (split.back () == " share" || split.back () == platform::libdir (env )) {
323323 split.pop_back ();
324324 }
325325 fs::path p{" /" };
@@ -407,8 +407,8 @@ namespace cps::search {
407407 // TODO: Windows…
408408 auto && split = utils::split (s, " /" );
409409 if (split[0 ] == " @prefix@" ) {
410- auto p =
411- prefix_path. value_or ( calculate_prefix (node->data .package .cps_path , node->data .package .name ));
410+ auto p = prefix_path. value_or (
411+ calculate_prefix (node->data .package .cps_path , node->data .package .name , env ));
412412 for (auto it = split.begin () + 1 ; it != split.end (); ++it) {
413413 p /= *it;
414414 }
0 commit comments