From 7b5d1e3d46e94262a9c0fd3a01ab4685aea9d12d Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 1 May 2021 15:10:54 -0400 Subject: Added bash completion, amongst others --- src/settings.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/settings.cc') diff --git a/src/settings.cc b/src/settings.cc index 56c26b3..96dc158 100644 --- a/src/settings.cc +++ b/src/settings.cc @@ -2,13 +2,14 @@ #include #include #include +#include namespace settings { const std::map dummySettings { - {"weapon", "/usr/share/dmtool/items/weapons/"}, - {"armor", "/usr/share/dmtool/items/armor/"}, - {"spellcasting", "/usr/share/dmtool/spells/"}, - {"monsters", "/usr/share/dmtool/monsters/"}, + {"weapons", "/usr/share/dmtool/weapons/"}, + {"armor", "/usr/share/dmtool/armor/"}, + {"spells", "/usr/share/dmtool/spells/"}, + {"creatures", "/usr/share/dmtool/creatures/"}, {"savedir", "~/.dmtool/"} }; @@ -30,10 +31,10 @@ namespace settings { } } - // Returns the setting, or an empty string in the case of an error + // Returns the setting, or an exception in the case of an error std::string getString(const std::string& key) { if(! dummySettings.contains(key)) { - return ""; + throw std::invalid_argument("Cannot find key: \"" + key + "\""); } std::string ret = dummySettings.at(key); autoExpandEnvironmentVariables(ret); -- cgit v1.2.3