mirror of
https://github.com/celisej567/abaddon.git
synced 2026-09-06 20:15:19 +03:00
add ABADDON_CONFIG environment variable
This commit is contained in:
10
platform.cpp
10
platform.cpp
@@ -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