summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcus Fritzsch <marcus_fritzsch@mentor.com>2017-08-01 17:15:19 +0200
committerMarcus Fritzsch <marcus_fritzsch@mentor.com>2017-08-08 17:24:00 +0200
commitda534c85f4dd4bb83a7f364a3b93a2ba156c7bcb (patch)
treea233dedf13b264a6f8f87c7aa23ca52f669c7c87
parenta156a120d1622aacef11abcc58fff1adb6a2f786 (diff)
app: use config to determine json config file names
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
-rw-r--r--src/app.cpp33
-rw-r--r--src/app.hpp3
2 files changed, 23 insertions, 13 deletions
diff --git a/src/app.cpp b/src/app.cpp
index 93877ba..aa3f644 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -114,27 +114,34 @@ App::App(wl::display *d)
display{d},
controller{},
outputs(),
+ config(),
layouts(),
layers() {
assert(g_app == nullptr);
g_app = this;
- {
- auto l = load_layer_map("../ids.json");
- if (l.is_ok()) {
- this->layers = l.unwrap();
- } else {
- logerror("%s", l.err().value());
+ try {
+ {
+ auto l = load_layer_map(
+ this->config.get_string("layers.json").value().c_str());
+ if (l.is_ok()) {
+ this->layers = l.unwrap();
+ } else {
+ logerror("%s", l.err().value());
+ }
}
- }
- {
- auto l = load_layout("../layout.json");
- if (l.is_ok()) {
- this->layouts = l.unwrap();
- } else {
- logerror("%s", l.err().value());
+ {
+ auto l = load_layout(
+ this->config.get_string("layout.json").value().c_str());
+ if (l.is_ok()) {
+ this->layouts = l.unwrap();
+ } else {
+ logerror("%s", l.err().value());
+ }
}
+ } catch (std::exception &e) {
+ logerror("Loading of configuration failed: %s", e.what());
}
}
diff --git a/src/app.hpp b/src/app.hpp
index 7b9164f..5bbd2db 100644
--- a/src/app.hpp
+++ b/src/app.hpp
@@ -14,6 +14,7 @@
#include "layout.hpp"
#include "result.hpp"
#include "wayland.hpp"
+#include "config.hpp"
namespace wl {
struct display;
@@ -35,6 +36,8 @@ struct App {
std::unique_ptr<struct genivi::controller> controller;
std::vector<std::unique_ptr<struct wl::output>> outputs;
+ struct config config;
+
layouts_type layouts;
layer_map layers;