Skip to content

Commit

Permalink
check for resources in local share
Browse files Browse the repository at this point in the history
  • Loading branch information
igagis committed Sep 19, 2024
1 parent 32f471c commit c0e9307
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/bedsidemon/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <iomanip>

#include <clargs/parser.hpp>
#include <papki/fs_file.hpp>
#include <ruis/widget/button/push_button.hpp>
#include <ruis/widget/group/overlay.hpp>
#include <utki/debug.hpp>
Expand Down Expand Up @@ -144,16 +145,23 @@ std::unique_ptr<application> 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;

p.add("window", "run in window mode", [&]() {
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;
});

Expand Down

0 comments on commit c0e9307

Please sign in to comment.