diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-11-07 11:47:51 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-11-07 11:47:51 +0200 |
commit | ee49a8c2a3dbe88c625599a750c9219e3118b008 (patch) | |
tree | 7ca30d23d63cb0e20c582960d1fcaf7f24ee09e1 | |
parent | 20bdee0cc92440a951c9e3842d1666ae8d01928c (diff) |
Make build.driver path absolute
-rw-r--r-- | build2/context.cxx | 14 | ||||
-rw-r--r-- | build2/utility | 4 | ||||
-rw-r--r-- | 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<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. // |