summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-08-02 16:13:58 -0500
committerJohn Wiegley <johnw@newartisans.com>2012-08-02 16:13:58 -0500
commitafc023406ad658f6f9a2cda69d7d6ce9492bc3af (patch)
tree6c8659730d9694af48f7eab48b79d7c89070a7ef /src
parent2de6af2761672c1b0697e285de20b291a3fc3a55 (diff)
downloadfork-ledger-afc023406ad658f6f9a2cda69d7d6ce9492bc3af.tar.gz
fork-ledger-afc023406ad658f6f9a2cda69d7d6ce9492bc3af.tar.bz2
fork-ledger-afc023406ad658f6f9a2cda69d7d6ce9492bc3af.zip
Always store absolute paths internally
Diffstat (limited to 'src')
-rw-r--r--src/context.h12
-rw-r--r--src/textual.cc5
2 files changed, 8 insertions, 9 deletions
diff --git a/src/context.h b/src/context.h
index 09734b3e..7373be39 100644
--- a/src/context.h
+++ b/src/context.h
@@ -112,16 +112,16 @@ inline parse_context_t open_for_reading(const path& pathname,
const path& cwd)
{
path filename = resolve_path(pathname);
-
+#if BOOST_VERSION >= 104600 && BOOST_FILESYSTEM_VERSION >= 3
+ filename = filesystem::absolute(filename, cwd);
+#else
+ filename = filesystem::complete(filename, cwd);
+#endif
if (! exists(filename))
throw_(std::runtime_error,
_f("Cannot read journal file %1%") % filename);
-#if BOOST_VERSION >= 104600 && BOOST_FILESYSTEM_VERSION >= 3
- path parent(filesystem::absolute(pathname, cwd).parent_path());
-#else
- path parent(filesystem::complete(pathname, cwd).parent_path());
-#endif
+ path parent(pathname.parent_path());
shared_ptr<std::istream> stream(new ifstream(filename));
parse_context_t context(stream, parent);
context.pathname = filename;
diff --git a/src/textual.cc b/src/textual.cc
index a5ae2f68..0ead9232 100644
--- a/src/textual.cc
+++ b/src/textual.cc
@@ -532,9 +532,8 @@ void instance_t::option_directive(char * line)
*p++ = '\0';
}
- path abs_path(filesystem::absolute(context.pathname,
- context.current_directory));
- if (! process_option(abs_path.string(), line + 2, *context.scope, p, line))
+ if (! process_option(context.pathname.string(), line + 2, *context.scope,
+ p, line))
throw_(option_error, _f("Illegal option --%1%") % (line + 2));
}