summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2013-01-29 13:15:16 -0800
committerJohn Wiegley <johnw@newartisans.com>2013-01-29 13:15:16 -0800
commitb14573fdb47404141435f0257715cc793630beb4 (patch)
tree31228e6aeac98518d674f5a05651875489fef2c9
parentc235b59a68d04ff22a16d317e4d67b69e570a1e4 (diff)
parent1903ff7c2ebdc2cccd4898fd98c28a0c4a74d5af (diff)
downloadfork-ledger-b14573fdb47404141435f0257715cc793630beb4.tar.gz
fork-ledger-b14573fdb47404141435f0257715cc793630beb4.tar.bz2
fork-ledger-b14573fdb47404141435f0257715cc793630beb4.zip
Merge pull request #137 from enderw88/default-pricedb-bug
Fixed problem finding the default priced file.
-rw-r--r--src/session.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/session.cc b/src/session.cc
index 632002d4..0f9cca22 100644
--- a/src/session.cc
+++ b/src/session.cc
@@ -62,12 +62,7 @@ void set_session_context(session_t * session)
session_t::session_t()
: flush_on_next_data_file(false), journal(new journal_t)
{
- if (const char * home_var = std::getenv("HOME"))
- HANDLER(price_db_).on(none, (path(home_var) / ".pricedb").string());
- else
- HANDLER(price_db_).on(none, path("./.pricedb").string());
-
- parsing_context.push();
+ parsing_context.push();
TRACE_CTOR(session_t, "");
}
@@ -101,7 +96,13 @@ std::size_t session_t::read_data(const string& master_account)
if (HANDLED(price_db_)){
price_db_path = resolve_path(HANDLER(price_db_).str());
if (!exists(price_db_path.get())){
- throw_(parse_error, _f("Could not find specified price file %1%") % price_db_path);
+ throw_(parse_error, _f("Could not find specified price-db file %1%") % price_db_path);
+ }
+ } else {
+ if (const char * home_var = std::getenv("HOME")){
+ price_db_path = (path(home_var) / ".pricedb");
+ } else {
+ price_db_path = ("./.ledgerrc");
}
}