mirror of
https://github.com/uowuo/abaddon.git
synced 2026-08-15 05:19:58 +00:00
add ABADDON_CONFIG environment variable
This commit is contained in:
1 parent
f7ac0f2a1e
commit
4b089606ea
3 files changed
+21
-2
No files matched your search
@@ -83,6 +83,9 @@ std::string Platform::FindResourceFolder() {
|
||||
}
|
||||
|
||||
std::string Platform::FindConfigFile() {
|
||||
const auto x = std::getenv("ABADDON_CONFIG");
|
||||
if (x != nullptr)
|
||||
return x;
|
||||
return "./abaddon.ini";
|
||||
}
|
||||
|
||||
@@ -103,6 +106,10 @@ std::string Platform::FindResourceFolder() {
|
||||
}
|
||||
|
||||
std::string Platform::FindConfigFile() {
|
||||
const auto x = std::getenv("ABADDON_CONFIG");
|
||||
if (x != nullptr)
|
||||
return x;
|
||||
|
||||
const auto home_path = std::string(std::getenv("HOME")) + "/.config/abaddon/abaddon.ini";
|
||||
for (const auto path : { "./abaddon.ini"s, home_path }) {
|
||||
if (IsFile(path)) return path;
|
||||
@@ -117,6 +124,9 @@ std::string Platform::FindResourceFolder() {
|
||||
}
|
||||
|
||||
std::string Platform::FindConfigFile() {
|
||||
const auto x = std::getenv("ABADDON_CONFIG");
|
||||
if (x != nullptr)
|
||||
return x;
|
||||
puts("unknown OS, trying to load config from cwd");
|
||||
return "./abaddon.ini";
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user