summaryrefslogtreecommitdiff
path: root/cli/cli/runtime-source.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'cli/cli/runtime-source.cxx')
-rw-r--r--cli/cli/runtime-source.cxx20
1 files changed, 19 insertions, 1 deletions
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;"