From 9f85ac0083423d0345e19edf96fb7a123c98f205 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 5 Dec 2020 21:42:21 +0300 Subject: Complete options file path against referencing file path --- cli/cli/runtime-source.cxx | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'cli/cli/runtime-source.cxx') diff --git a/cli/cli/runtime-source.cxx b/cli/cli/runtime-source.cxx index e3d904a..7f582c0 100644 --- a/cli/cli/runtime-source.cxx +++ b/cli/cli/runtime-source.cxx @@ -653,8 +653,26 @@ generate_runtime_source (context& ctx, bool complete) << "load (f);" << "}" << "else" << endl + << "{" + << "// If the path of the file being parsed is not simple and the" << endl + << "// path of the file that needs to be loaded is relative, then" << endl + << "// complete the later path against the former one." << endl + << "//" << endl + << "#ifndef _WIN32" << endl + << "string::size_type n (file.find_last_of ('/'));" + << "bool c (n != string::npos && !(s2.size () != 0 && s2[0] == '/'));" + << "#else" << endl + << "string::size_type n (file.find_last_of (\"/\\\\\"));" + << "bool c (n != string::npos && !(s2.size () > 1 && s2[1] == ':'));" + << "#endif" << endl + << "if (c)" + << "{" + << "string s (file, 0, n + 1);" + << "s += s2;" + << "s2.swap (s);" + << "}" << "load (s2);" - << endl + << "}" << "continue;" << "}" << "a.value = s1;" -- cgit v1.1