summaryrefslogtreecommitdiff
path: root/src/session.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-10-28 01:50:55 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-10-28 01:50:55 -0400
commit8b3a75fbbf39e01fa058c3f9552b06363ed6a75a (patch)
tree9d94d4547a58d79b3a4ff906983f69fca25f1021 /src/session.cc
parent18a1c8a3fb7bdd1fc3eba8c5ab799ef79cd73b7c (diff)
downloadfork-ledger-8b3a75fbbf39e01fa058c3f9552b06363ed6a75a.tar.gz
fork-ledger-8b3a75fbbf39e01fa058c3f9552b06363ed6a75a.tar.bz2
fork-ledger-8b3a75fbbf39e01fa058c3f9552b06363ed6a75a.zip
The default ledger file is now ~/.ledger
Diffstat (limited to 'src/session.cc')
-rw-r--r--src/session.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/session.cc b/src/session.cc
index b46d545e..2e728dd6 100644
--- a/src/session.cc
+++ b/src/session.cc
@@ -121,8 +121,16 @@ std::size_t session_t::read_journal(const path& pathname,
std::size_t session_t::read_data(const string& master_account)
{
- if (HANDLER(file_).data_files.empty())
- throw_(parse_error, "No journal file was specified (please use -f)");
+ if (HANDLER(file_).data_files.empty()) {
+ path file;
+ if (const char * home_var = std::getenv("HOME"))
+ file = path(home_var) / ".ledger";
+
+ if (! file.empty() && exists(file))
+ HANDLER(file_).data_files.push_back(file);
+ else
+ throw_(parse_error, "No journal file was specified (please use -f)");
+ }
std::size_t xact_count = 0;