diff options
Diffstat (limited to 'platform.cpp')
-rw-r--r-- | platform.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/platform.cpp b/platform.cpp index a85c3bb..b5e92e3 100644 --- a/platform.cpp +++ b/platform.cpp @@ -91,18 +91,24 @@ std::string Platform::FindConfigFile() { #elif defined(__linux__) std::string Platform::FindResourceFolder() { - static std::string path; + static std::string found_path; static bool found = false; - if (found) return path; + if (found) return found_path; - if (IsFolder("/usr/share/abaddon/res") && IsFolder("/usr/share/abaddon/css")) { - path = "/usr/share/abaddon"; - } else { - puts("resources are not in /usr/share/abaddon, will try to load from cwd"); - path = "."; + const static std::string home_path = std::getenv("HOME") + "/.config/abaddon"s; + + for (const auto &path : { "."s, home_path, "/usr/share/abaddon"s }) { + if (IsFolder(path + "/res") && IsFolder(path + "/css")) { + found_path = path; + found = true; + return found_path; + } } + + puts("cant find a resources folder, will try to load from cwd"); + found_path = "."; found = true; - return path; + return found_path; } std::string Platform::FindConfigFile() { |