From 16a2a16097e356a12feb18a091fd4f19993c350e Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 10 Nov 2009 01:06:04 -0500 Subject: [PATCH] Support include-ing of relative pathnames --- src/textual.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/textual.cc b/src/textual.cc index ca7aa190..1d8de046 100644 --- a/src/textual.cc +++ b/src/textual.cc @@ -608,7 +608,17 @@ void instance_t::xact_directive(char * line, std::streamsize len) void instance_t::include_directive(char * line) { - path filename(line); + path filename; + + if (line[0] != '/' && line[0] != '\\' && line[0] != '~') { + string::size_type pos = pathname.string().rfind('/'); + if (pos == string::npos) + pos = pathname.string().rfind('\\'); + if (pos != string::npos) + filename = path(string(pathname.string(), 0, pos + 1)) / line; + } else { + filename = line; + } filename = resolve_path(filename);