summaryrefslogtreecommitdiff
path: root/src/session.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-18 21:00:02 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-18 21:00:02 -0400
commitec08dee745ee7c1bda63defa2828ce98e438370b (patch)
treef10b51e0ea64c4eed5c17115c62d5d9c0aaa70c5 /src/session.cc
parentdac10c8cf624613b9bdebe33e2d10c68ff310c50 (diff)
downloadfork-ledger-ec08dee745ee7c1bda63defa2828ce98e438370b.tar.gz
fork-ledger-ec08dee745ee7c1bda63defa2828ce98e438370b.tar.bz2
fork-ledger-ec08dee745ee7c1bda63defa2828ce98e438370b.zip
Always perform tilde expansion on input pathnames
Diffstat (limited to 'src/session.cc')
-rw-r--r--src/session.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/session.cc b/src/session.cc
index 5bc7ed8d..1e2dfb64 100644
--- a/src/session.cc
+++ b/src/session.cc
@@ -110,13 +110,15 @@ std::size_t session_t::read_data(const string& master_account)
if (! master_account.empty())
acct = journal->find_account(master_account);
- if (HANDLED(price_db_) && exists(path(HANDLER(price_db_).str()))) {
- if (read_journal(HANDLER(price_db_).str()))
- throw_(parse_error, "Entries not allowed in price history file");
+ if (HANDLED(price_db_)) {
+ path price_db_path = resolve_path(HANDLER(price_db_).str());
+ if (exists(price_db_path) && read_journal(price_db_path) > 0)
+ throw_(parse_error, "Entries not allowed in price history file");
}
foreach (const path& pathname, HANDLER(file_).data_files) {
- if (pathname == "-") {
+ path filename = resolve_path(pathname);
+ if (filename == "-") {
// To avoid problems with stdin and pipes, etc., we read the entire
// file in beforehand into a memory buffer, and then parcel it out
// from there.
@@ -134,11 +136,11 @@ std::size_t session_t::read_data(const string& master_account)
entry_count += read_journal(buf_in, "/dev/stdin", acct);
}
- else if (exists(pathname)) {
- entry_count += read_journal(pathname, acct);
+ else if (exists(filename)) {
+ entry_count += read_journal(filename, acct);
}
else {
- throw_(parse_error, "Could not open journal file '" << pathname << "'");
+ throw_(parse_error, "Could not read journal file '" << filename << "'");
}
}