possibility to get a default value in Config.get

This commit is contained in:
skilion 2015-09-17 16:43:45 +02:00
parent 35c290c4a0
commit 9867a7abea

View file

@ -10,12 +10,13 @@ struct Config
this.filename = filename;
}
string get(string key)
string get(string key, string def = null)
{
import core.exception;
try {
return values[key];
} catch (RangeError e) {
if (def) return def;
throw new Exception("Missing config value: " ~ key);
}
}