diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-06-30 21:45:26 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-06-30 21:45:26 -0400 |
commit | 4b089606eaa969036ec75379dade260302e29891 (patch) | |
tree | ccfe3b066fd113e15b52b04fbc8162163136eb97 | |
parent | f7ac0f2a1ea373d28f630021c8567f0afb035568 (diff) | |
download | abaddon-portaudio-4b089606eaa969036ec75379dade260302e29891.tar.gz abaddon-portaudio-4b089606eaa969036ec75379dade260302e29891.zip |
add ABADDON_CONFIG environment variable
-rw-r--r-- | README.md | 11 | ||||
-rw-r--r-- | abaddon.cpp | 2 | ||||
-rw-r--r-- | platform.cpp | 10 |
3 files changed, 21 insertions, 2 deletions
@@ -54,7 +54,11 @@ Or, do steps 1 and 2, and open CMakeLists.txt in Visual Studio if `vcpkg integra - MacOS: [here](https://nightly.link/uowuo/abaddon/workflows/ci/master/build-macos-RelWithDebInfo.zip) unsigned, unpackaged, requires gtkmm3 (e.g. from homebrew) - Linux: [here](https://nightly.link/uowuo/abaddon/workflows/ci/master/build-linux-MinSizeRel.zip) unpackaged (for now), requires gtkmm3. built on Ubuntu 18.04 + gcc9 -⚠️ Make sure you start from the directory where `css` and `res` are or else stuff will be broken +⚠️ If you use Windows, make sure to start from the directory containing `css` and `res` + +If you don't use Windows, `css` and `res` can be loaded from `/usr/share/abaddon` + +`abaddon.ini` will also be automatically used if located at `~/.config/abaddon/abaddon.ini` and there is no `abaddon.ini` in the working directory #### Dependencies: * [gtkmm](https://www.gtkmm.org/en/) @@ -196,3 +200,8 @@ For example, memory_db would be set by adding `memory_db = true` under the line #### misc * linkcolor (string) - color to use for links in messages + +### Environment variables + +* ABADDON_NO_FC (Windows only) - don't use custom font config +* ABADDON_CONFIG - change path of configuration file to use. relative to cwd or can be absolute diff --git a/abaddon.cpp b/abaddon.cpp index 8b08c8a..f0729a9 100644 --- a/abaddon.cpp +++ b/abaddon.cpp @@ -22,7 +22,7 @@ Abaddon::Abaddon() : m_settings(Platform::FindConfigFile()) - , m_emojis(GetResPath() + "/emojis.bin") + , m_emojis(GetResPath("/emojis.bin")) , m_discord(m_settings.GetUseMemoryDB()) { // stupid but easy LoadFromSettings(); diff --git a/platform.cpp b/platform.cpp index 9448cc6..a85c3bb 100644 --- a/platform.cpp +++ b/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"; } |