osme stuf
This commit is contained in:
parent
4f039f9c79
commit
dff976ed0e
7 changed files with 44 additions and 48 deletions
|
@ -4,12 +4,18 @@
|
|||
|
||||
using rfl::Result;
|
||||
|
||||
fn Config::getInstance() -> Config {
|
||||
inline fn GetConfigPath() -> string {
|
||||
return getenv(
|
||||
#ifdef __WIN32__
|
||||
const string path = string(getenv("LOCALAPPDATA")) + "\\draconis++\\config.toml";
|
||||
"LOCALAPPDATA"
|
||||
#else
|
||||
const string path = string(getenv("HOME")) + "/.config/draconis++/config.toml";
|
||||
"HOME"
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
fn Config::getInstance() -> Config {
|
||||
const string path = GetConfigPath() + "\\draconis++\\config.toml";
|
||||
const Result<Config> result = rfl::toml::load<Config>(path);
|
||||
|
||||
if (result)
|
||||
|
@ -18,4 +24,3 @@ fn Config::getInstance() -> Config {
|
|||
fmt::println("Failed to load config file: {}", result.error().value().what());
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue