scuklle
This commit is contained in:
parent
95374d942d
commit
f9a9491da3
9 changed files with 141 additions and 103 deletions
|
@ -8,22 +8,24 @@
|
|||
using rfl::Result;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
inline fn GetConfigPath() -> fs::path {
|
||||
namespace {
|
||||
inline fn GetConfigPath() -> fs::path {
|
||||
#ifdef _WIN32
|
||||
const char* localAppData = std::getenv("LOCALAPPDATA");
|
||||
const char* localAppData = std::getenv("LOCALAPPDATA");
|
||||
|
||||
if (!localAppData)
|
||||
throw std::runtime_error("Environment variable LOCALAPPDATA is not set");
|
||||
if (!localAppData)
|
||||
throw std::runtime_error("Environment variable LOCALAPPDATA is not set");
|
||||
|
||||
return fs::path(localAppData);
|
||||
return fs::path(localAppData);
|
||||
#else
|
||||
const char* home = std::getenv("HOME");
|
||||
const char* home = std::getenv("HOME");
|
||||
|
||||
if (!home)
|
||||
throw std::runtime_error("Environment variable HOME is not set");
|
||||
if (!home)
|
||||
throw std::runtime_error("Environment variable HOME is not set");
|
||||
|
||||
return fs::path(home) / ".config";
|
||||
return fs::path(home) / ".config";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
fn Config::getInstance() -> Config {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue