From db52ad86d5cd12ddd1f1bac9e654dbf18c750ac3 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Thu, 5 Feb 2009 02:16:43 -0400 Subject: [PATCH] Don't give an error if the init file cannot be found. --- src/session.cc | 24 ++++++++++-------------- 1 file 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"); + 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 << "'"); + } - 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 << "'"); + TRACE_FINISH(init, 1); } - - TRACE_FINISH(init, 1); } std::size_t session_t::read_data(journal_t& journal,