diff options
author | Craig Earls <enderw88@gmail.com> | 2013-01-29 14:10:08 -0700 |
---|---|---|
committer | Craig Earls <enderw88@gmail.com> | 2013-01-29 14:10:08 -0700 |
commit | 1903ff7c2ebdc2cccd4898fd98c28a0c4a74d5af (patch) | |
tree | 31228e6aeac98518d674f5a05651875489fef2c9 /src | |
parent | c235b59a68d04ff22a16d317e4d67b69e570a1e4 (diff) | |
download | fork-ledger-1903ff7c2ebdc2cccd4898fd98c28a0c4a74d5af.tar.gz fork-ledger-1903ff7c2ebdc2cccd4898fd98c28a0c4a74d5af.tar.bz2 fork-ledger-1903ff7c2ebdc2cccd4898fd98c28a0c4a74d5af.zip |
Fixed problem finding the default priced file.
Bug fix to detect badly specified priced files on the command line didn't handle the default correctly.
Diffstat (limited to 'src')
-rw-r--r-- | src/session.cc | 15 |
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"); } } |