aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-12-08 18:15:14 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-12-08 18:15:14 +0300
commit398c7ad035b4c9afb261dacce38f9ac74822e8ca (patch)
tree631b7956b47a3bf9c59ab866954b0f7b31528478
parent4e3e12364f172344bff38e03b48a1c048df0f479 (diff)
Regenerate options parsing code
-rw-r--r--odb/options.cxx18
1 files changed, 17 insertions, 1 deletions
diff --git a/odb/options.cxx b/odb/options.cxx
index a6dd710..9065abc 100644
--- a/odb/options.cxx
+++ b/odb/options.cxx
@@ -460,12 +460,28 @@ namespace cli
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;
}