aboutsummaryrefslogtreecommitdiff
path: root/bpkg/utility.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-02-22 10:20:14 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-02-22 10:20:14 +0200
commit5837974ede1f489fe1e65cb10188f776fb6d1974 (patch)
tree958b345fd8b3490b358ca0807a1d3c220fc89fab /bpkg/utility.cxx
parent10827e2338f9390383c30c95a2cbbfd733d76088 (diff)
WIP
Diffstat (limited to 'bpkg/utility.cxx')
-rw-r--r--bpkg/utility.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/bpkg/utility.cxx b/bpkg/utility.cxx
index b79c85b..96fda0f 100644
--- a/bpkg/utility.cxx
+++ b/bpkg/utility.cxx
@@ -369,6 +369,26 @@ namespace bpkg
: BPKG_EXE_PREFIX "b" BPKG_EXE_SUFFIX;
}
+ process_path
+ search_b (const common_options& co)
+ {
+ const char* b (name_b (co));
+
+ try
+ {
+ // Use our executable directory as a fallback search since normally the
+ // entire toolchain is installed into one directory. This way, for
+ // example, if we installed into /opt/build2 and run bpkg with absolute
+ // path (and without PATH), then bpkg will be able to find "its" b.
+ //
+ return process::path_search (b, exec_dir);
+ }
+ catch (const process_error& e)
+ {
+ fail << "unable to execute " << b << ": " << e << endf;
+ }
+ }
+
void
dump_stderr (auto_fd&& fd)
{