diff options
author | John Wiegley <johnw@newartisans.com> | 2012-10-25 12:52:03 -0700 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2012-10-25 12:52:03 -0700 |
commit | 34ca6b3991d63dd04d60286452399c7e0d49974b (patch) | |
tree | 09629526f7dd09e9bcaf4a41ed7df8b326c6a1eb /src/global.h | |
parent | de729114d1be1e6b0bb92c3b5e3f157308c67eae (diff) | |
parent | 4b261f99bc56853b3468a8a1bb5b4af39ed67af5 (diff) | |
download | fork-ledger-34ca6b3991d63dd04d60286452399c7e0d49974b.tar.gz fork-ledger-34ca6b3991d63dd04d60286452399c7e0d49974b.tar.bz2 fork-ledger-34ca6b3991d63dd04d60286452399c7e0d49974b.zip |
Merge pull request #95 from enderw88/Bug695-init-file
Bug695 init file
Diffstat (limited to 'src/global.h')
-rw-r--r-- | src/global.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/global.h b/src/global.h index f797ba01..d37043fc 100644 --- a/src/global.h +++ b/src/global.h @@ -46,6 +46,8 @@ namespace ledger { class session_t; class report_t; +extern std::string _init_file; + class global_scope_t : public noncopyable, public scope_t { shared_ptr<session_t> session_ptr; @@ -151,10 +153,14 @@ See LICENSE file included with the distribution for details and disclaimer."); OPTION__ (global_scope_t, init_file_, // -i CTOR(global_scope_t, init_file_) { - if (const char * home_var = std::getenv("HOME")) - on(none, (path(home_var) / ".ledgerrc").string()); - else - on(none, path("./.ledgerrc").string()); + if(!_init_file.empty()) + // _init_file is filled during handle_debug_options + on(none, _init_file); + else + if (const char * home_var = std::getenv("HOME")) + on(none, (path(home_var) / ".ledgerrc").string()); + else + on(none, path("./.ledgerrc").string()); }); OPTION(global_scope_t, options); |