aboutsummaryrefslogtreecommitdiff
path: root/src/settings.cc
diff options
context:
space:
mode:
authorYour Name <you@example.com>2021-05-01 15:10:54 -0400
committerYour Name <you@example.com>2021-05-01 15:10:54 -0400
commit7b5d1e3d46e94262a9c0fd3a01ab4685aea9d12d (patch)
treed9b808542216f71dbab053ad23145903e96c6401 /src/settings.cc
parent5a813a75412ac9b8fadb90c9abd46dd95aee8e9b (diff)
downloaddmtool-7b5d1e3d46e94262a9c0fd3a01ab4685aea9d12d.tar.gz
dmtool-7b5d1e3d46e94262a9c0fd3a01ab4685aea9d12d.tar.bz2
dmtool-7b5d1e3d46e94262a9c0fd3a01ab4685aea9d12d.zip
Added bash completion, amongst others
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);