summaryrefslogtreecommitdiff
path: root/src/session.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-05 02:16:43 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-05 02:16:43 -0400
commitdb52ad86d5cd12ddd1f1bac9e654dbf18c750ac3 (patch)
tree99790f123dabafed2a620257f0441577a9b6514f /src/session.cc
parent3f960be96c47cc976ed3a4d9e477325b6a3fcfb7 (diff)
downloadfork-ledger-db52ad86d5cd12ddd1f1bac9e654dbf18c750ac3.tar.gz
fork-ledger-db52ad86d5cd12ddd1f1bac9e654dbf18c750ac3.tar.bz2
fork-ledger-db52ad86d5cd12ddd1f1bac9e654dbf18c750ac3.zip
Don't give an error if the init file cannot be found.
Diffstat (limited to 'src/session.cc')
-rw-r--r--src/session.cc24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/session.cc b/src/session.cc
index c646eab4..dbeaae61 100644
--- a/src/session.cc
+++ b/src/session.cc
@@ -172,24 +172,20 @@ std::size_t session_t::read_journal(journal_t& journal,
void session_t::read_init()
{
- if (! init_file)
- return;
+ if (init_file && exists(*init_file)) {
+ TRACE_START(init, 1, "Read initialization file");
- if (! exists(*init_file))
- throw_(std::logic_error, "Cannot read init file" << *init_file);
+ ifstream init(*init_file);
- TRACE_START(init, 1, "Read initialization file");
-
- ifstream init(*init_file);
+ journal_t temp;
+ if (read_journal(temp, *init_file) > 0 ||
+ temp.auto_entries.size() > 0 || temp.period_entries.size() > 0) {
+ throw_(parse_error,
+ "Entries found in initialization file '" << init_file << "'");
+ }
- journal_t temp;
- if (read_journal(temp, *init_file) > 0 ||
- temp.auto_entries.size() > 0 || temp.period_entries.size() > 0) {
- throw_(parse_error,
- "Entries found in initialization file '" << init_file << "'");
+ TRACE_FINISH(init, 1);
}
-
- TRACE_FINISH(init, 1);
}
std::size_t session_t::read_data(journal_t& journal,