Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ Latest release version: https://github.com/uowuo/abaddon/releases/latest

The two folders within the `res` folder (`res/res` and `res/css`) are necessary. Windows also uses the `fonts` folder.
You can put them directly next to the executable. On Linux, `css` and `res` can also be loaded from
`~/.local/share/abaddon` or `/usr/share/abaddon`
`~/.local/share/abaddon` or `/usr/share/abaddon`. On macOS, when installed via package managers
such as Homebrew, the install prefix (e.g. `/usr/local/share/abaddon` or the Homebrew Cellar location)
is also checked for resources.

`abaddon.ini` will also be automatically used if located at `~/.config/abaddon/abaddon.ini` and there is
no `abaddon.ini` in the working directory
Expand Down
21 changes: 15 additions & 6 deletions src/platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
#ifdef __APPLE__
#include <unistd.h>
#endif
#ifdef __linux__
#include "util.hpp"
#endif
#include "util.hpp"

#include <spdlog/spdlog.h>

Expand Down Expand Up @@ -176,9 +174,20 @@ std::string Platform::FindResourceFolder() {
if (resourceURL != NULL) {
CFRelease(resourceURL);
}
found_path = resourcePath;
found = true;
return found_path;
}

// Fall back to cwd, user dir or install prefix (e.g. Homebrew installs into share/abaddon)
const auto home_env = std::getenv("HOME");
if (home_env != nullptr) {
const static std::string home_path = std::string(home_env) + "/.local/share/abaddon";

for (const auto &path : {std::string(resourcePath), "."s, home_path, std::string(ABADDON_DEFAULT_RESOURCE_DIR)}) {
if (util::IsFolder(path + "/res") && util::IsFolder(path + "/css")) {
found_path = path;
found = true;
return found_path;
}
}
}

spdlog::get("discord")->warn("cant find a resources folder, will try to load from cwd");
Expand Down