From ee49a8c2a3dbe88c625599a750c9219e3118b008 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 7 Nov 2016 11:47:51 +0200 Subject: Make build.driver path absolute --- build2/context.cxx | 14 +++++++++++++- build2/utility | 4 ++-- build2/utility.cxx | 6 ++++-- 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 ("extension", variable_visibility::target); } - gs.assign ("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 ("build.driver") = move (p); + } gs.assign ("build.work") = work; gs.assign ("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. // -- cgit v1.1