aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-12-08 17:55:07 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-12-08 17:55:07 +0300
commitb971493841a601041cac1f680e3828e8d223e6f2 (patch)
tree0ba87a0092848768b46fcca4545a9f8c57521ef7
parent426035e6fb01f7dd3ea533e32f0efb0f6c1e0db1 (diff)
Regenerate options parsing code
-rw-r--r--build2/b-options.cxx18
1 files changed, 17 insertions, 1 deletions
diff --git a/build2/b-options.cxx b/build2/b-options.cxx
index 8e424f9..c061fef 100644
--- a/build2/b-options.cxx
+++ b/build2/b-options.cxx
@@ -462,12 +462,28 @@ namespace build2
if (oi->search_func != 0)
{
- std::string f (oi->search_func (s2.c_str (), oi->arg));
+ string f (oi->search_func (s2.c_str (), oi->arg));
if (!f.empty ())
load (f);
}
else
+ {
+ // If the path of the file being parsed is not simple and the
+ // path of the file that needs to be loaded is relative, then
+ // complete the latter using the former as a base.
+ //
+#ifndef _WIN32
+ string::size_type p (file.find_last_of ('/'));
+ bool c (p != string::npos && s2[0] != '/');
+#else
+ string::size_type p (file.find_last_of ("/\\"));
+ bool c (p != string::npos && s2[1] != ':');
+#endif
+ if (c)
+ s2.insert (0, file, 0, p + 1);
+
load (s2);
+ }
continue;
}