mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-08 17:02:25 +02:00
possibility to get a default value in Config.get
This commit is contained in:
parent
35c290c4a0
commit
9867a7abea
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue