aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/context.cxx14
-rw-r--r--build2/utility4
-rw-r--r--build2/utility.cxx6
3 files changed, 19 insertions, 5 deletions
diff --git a/build2/context.cxx b/build2/context.cxx
index 1b5e03c..03e64cd 100644
--- a/build2/context.cxx
+++ b/build2/context.cxx
@@ -236,7 +236,19 @@ namespace build2
v.insert<string> ("extension", variable_visibility::target);
}
- gs.assign<path> ("build.driver") = argv0;
+ // Absolute path to the build system driver.
+ //
+ {
+ path p (argv0.effect_string ());
+
+ if (p.relative ())
+ {
+ p = work / p;
+ p.normalize ();
+ }
+
+ gs.assign<path> ("build.driver") = move (p);
+ }
gs.assign<dir_path> ("build.work") = work;
gs.assign<dir_path> ("build.home") = home;
diff --git a/build2/utility b/build2/utility
index 719eb60..e08ae69 100644
--- a/build2/utility
+++ b/build2/utility
@@ -88,9 +88,9 @@ namespace build2
//
extern options ops;
- // Build system driver recall path (argv[0]).
+ // Build system driver process path (argv0.initial is argv[0]).
//
- extern path argv0;
+ extern process_path argv0;
// Work/home directories (must be initialized in main()) and relative path
// calculation.
diff --git a/build2/utility.cxx b/build2/utility.cxx
index 5b6056d..5d65f7b 100644
--- a/build2/utility.cxx
+++ b/build2/utility.cxx
@@ -90,7 +90,7 @@ namespace build2
}
options ops;
- path argv0;
+ process_path argv0;
dir_path work;
dir_path home;
const dir_path* relative_base = &work;
@@ -509,7 +509,9 @@ namespace build2
void
init (const char* a0, uint16_t v)
{
- argv0 = path (a0);
+ // Build system driver process path.
+ //
+ argv0 = process::path_search (a0, true);
// Diagnostics verbosity.
//