aboutsummaryrefslogtreecommitdiff
path: root/src/settings.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/settings.cc')
-rw-r--r--src/settings.cc13
1 files changed, 7 insertions, 6 deletions
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 <map>
#include <cstdlib>
#include <regex>
+#include <stdexcept>
namespace settings {
const std::map<std::string, std::string> 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);