From c0e9307708f9f9b3afa93b1cb6edc5d39a7b8820 Mon Sep 17 00:00:00 2001 From: Ivan Gagis Date: Thu, 19 Sep 2024 11:00:49 +0300 Subject: [PATCH] check for resources in local share --- src/bedsidemon/application.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/bedsidemon/application.cpp b/src/bedsidemon/application.cpp index d8f9776..4cc0a5d 100644 --- a/src/bedsidemon/application.cpp +++ b/src/bedsidemon/application.cpp @@ -24,6 +24,7 @@ along with this program. If not, see . #include #include +#include #include #include #include @@ -144,8 +145,15 @@ std::unique_ptr bedsidemon::create_application(std::string_view exe { bool window = false; - // TODO: look in /usr/local/share/bedsidemon first? - std::string res_path = "/usr/share/bedsidemon"s; + std::string res_path = []() { + papki::fs_file local_share("/usr/local/share/bedsidemon/"sv); + + if (local_share.exists()) { + return local_share.path(); + } + + return "/usr/share/bedsidemon/"s; + }(); clargs::parser p; @@ -153,7 +161,7 @@ std::unique_ptr bedsidemon::create_application(std::string_view exe window = true; }); - p.add("res-path", "resources path, default = /usr/share/bedsidemon", [&](std::string_view v) { + p.add("res-path", "resources path, default = /usr/share/bedsidemon/", [&](std::string_view v) { res_path = v; });