summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/context.h12
-rw-r--r--src/textual.cc5
-rw-r--r--test/baseline/cmd-convert.test4
-rw-r--r--test/baseline/opt-file.test2
-rw-r--r--test/regress/25A099C9.test40
5 files changed, 31 insertions, 32 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));
}
diff --git a/test/baseline/cmd-convert.test b/test/baseline/cmd-convert.test
index 181165df..1c36d4bb 100644
--- a/test/baseline/cmd-convert.test
+++ b/test/baseline/cmd-convert.test
@@ -17,7 +17,7 @@ end test
test -f /dev/null --input-date-format "%m/%d/%Y" convert test/baseline/cmd-convert3.dat -> 1
__ERROR__
-While parsing file "test/baseline/cmd-convert3.dat", line 1:
+While parsing file "$sourcepath/test/baseline/cmd-convert3.dat", line 1:
While parsing CSV line:
01/01/2011,,
@@ -26,7 +26,7 @@ end test
test -f /dev/null convert test/baseline/cmd-convert4.dat -> 1
__ERROR__
-While parsing file "test/baseline/cmd-convert4.dat", line 1:
+While parsing file "$sourcepath/test/baseline/cmd-convert4.dat", line 1:
While parsing CSV line:
bogus,$10,
diff --git a/test/baseline/opt-file.test b/test/baseline/opt-file.test
index e01d929d..66d0ab1b 100644
--- a/test/baseline/opt-file.test
+++ b/test/baseline/opt-file.test
@@ -1,6 +1,6 @@
test -f opt-file-does-not-exist.dat bal -> 1
__ERROR__
-Error: Cannot read journal file "opt-file-does-not-exist.dat"
+Error: Cannot read journal file "$sourcepath/opt-file-does-not-exist.dat"
end test
test -f test/baseline/opt-file1.dat -f test/baseline/opt-file2.dat bal
diff --git a/test/regress/25A099C9.test b/test/regress/25A099C9.test
index 1ef5ebef..d4eab662 100644
--- a/test/regress/25A099C9.test
+++ b/test/regress/25A099C9.test
@@ -1,43 +1,43 @@
test -f src/amount.h reg -> 20
__ERROR__
-While parsing file "src/amount.h", line 2:
+While parsing file "$sourcepath/src/amount.h", line 2:
Error: Unexpected whitespace at beginning of line
-While parsing file "src/amount.h", line 33:
+While parsing file "$sourcepath/src/amount.h", line 33:
Error: Unexpected whitespace at beginning of line
-While parsing file "src/amount.h", line 37:
+While parsing file "$sourcepath/src/amount.h", line 37:
Error: Unexpected whitespace at beginning of line
-While parsing file "src/amount.h", line 66:
+While parsing file "$sourcepath/src/amount.h", line 66:
Error: No quantity specified for amount
-While parsing file "src/amount.h", line 69:
+While parsing file "$sourcepath/src/amount.h", line 69:
Error: Unexpected whitespace at beginning of line
-While parsing file "src/amount.h", line 83:
+While parsing file "$sourcepath/src/amount.h", line 83:
Error: Unexpected whitespace at beginning of line
-While parsing file "src/amount.h", line 93:
+While parsing file "$sourcepath/src/amount.h", line 93:
Error: Unexpected whitespace at beginning of line
-While parsing file "src/amount.h", line 99:
+While parsing file "$sourcepath/src/amount.h", line 99:
Error: Unexpected whitespace at beginning of line
-While parsing file "src/amount.h", line 121:
+While parsing file "$sourcepath/src/amount.h", line 121:
Error: Unexpected whitespace at beginning of line
-While parsing file "src/amount.h", line 132:
+While parsing file "$sourcepath/src/amount.h", line 132:
Error: Unexpected whitespace at beginning of line
-While parsing file "src/amount.h", line 702:
+While parsing file "$sourcepath/src/amount.h", line 702:
Error: Unexpected whitespace at beginning of line
-While parsing file "src/amount.h", line 732:
+While parsing file "$sourcepath/src/amount.h", line 732:
Error: Unexpected whitespace at beginning of line
-While parsing file "src/amount.h", line 740:
+While parsing file "$sourcepath/src/amount.h", line 740:
Error: Unexpected whitespace at beginning of line
-While parsing file "src/amount.h", line 743:
+While parsing file "$sourcepath/src/amount.h", line 743:
Error: Invalid date/time: line amount_t amoun
-While parsing file "src/amount.h", line 749:
+While parsing file "$sourcepath/src/amount.h", line 749:
Error: Invalid date/time: line string amount_
-While parsing file "src/amount.h", line 755:
+While parsing file "$sourcepath/src/amount.h", line 755:
Error: Invalid date/time: line string amount_
-While parsing file "src/amount.h", line 761:
+While parsing file "$sourcepath/src/amount.h", line 761:
Error: Invalid date/time: line string amount_
-While parsing file "src/amount.h", line 767:
+While parsing file "$sourcepath/src/amount.h", line 767:
Error: Invalid date/time: line std::ostream&
-While parsing file "src/amount.h", line 774:
+While parsing file "$sourcepath/src/amount.h", line 774:
Error: Invalid date/time: line std::istream&
-While parsing file "src/amount.h", line 780:
+While parsing file "$sourcepath/src/amount.h", line 780:
Error: Unexpected whitespace at beginning of line
end test