Skip to content
Snippets Groups Projects
Commit 38ce9e8a authored by Nicolas Jager's avatar Nicolas Jager
Browse files

file system: respond to get app path signal from daemon.

Checks for config file

Change-Id: I681563851c7ba90c24355c034174b4ecaa856c55
parent 32ed1a2b
No related branches found
No related tags found
No related merge requests found
...@@ -33,6 +33,9 @@ using namespace Windows::UI::Core; ...@@ -33,6 +33,9 @@ using namespace Windows::UI::Core;
using namespace RingClientUWP; using namespace RingClientUWP;
CoreDispatcher^ g_dispatcher;
bool has_config;
void void
DebugOutputWrapper(const std::string& str) DebugOutputWrapper(const std::string& str)
{ {
...@@ -42,6 +45,19 @@ DebugOutputWrapper(const std::string& str) ...@@ -42,6 +45,19 @@ DebugOutputWrapper(const std::string& str)
void void
RingClientUWP::RingD::startDaemon() RingClientUWP::RingD::startDaemon()
{ {
g_dispatcher = CoreApplication::MainView->CoreWindow->Dispatcher;
Utils::fileExists(ApplicationData::Current->LocalFolder, ".config\\dring.yml")
.then([this](bool config_exists)
{
if (!config_exists) {
has_config = false;
}
else {
has_config = true;
}
})
.then([this]() {
create_task([&]() create_task([&]()
{ {
using SharedCallback = std::shared_ptr<DRing::CallbackWrapperBase>; using SharedCallback = std::shared_ptr<DRing::CallbackWrapperBase>;
...@@ -110,14 +126,13 @@ RingClientUWP::RingD::startDaemon() ...@@ -110,14 +126,13 @@ RingClientUWP::RingD::startDaemon()
return; return;
} }
else { else {
if (!hasConfig) // if there is no config, create a default RING account
{ if (!has_config) {
std::map<std::string, std::string> test_details; std::map<std::string, std::string> test_details;
test_details.insert(std::make_pair(ring::Conf::CONFIG_ACCOUNT_ALIAS, accountName)); test_details.insert(std::make_pair(ring::Conf::CONFIG_ACCOUNT_ALIAS, "default"));
test_details.insert(std::make_pair(ring::Conf::CONFIG_ACCOUNT_TYPE, "RING")); test_details.insert(std::make_pair(ring::Conf::CONFIG_ACCOUNT_TYPE, "RING"));
DRing::addAccount(test_details); DRing::addAccount(test_details);
} }
// if there is no config, create a default RING account
while (true) { while (true) {
DRing::pollEvents(); DRing::pollEvents();
Sleep(1000); Sleep(1000);
...@@ -125,6 +140,7 @@ RingClientUWP::RingD::startDaemon() ...@@ -125,6 +140,7 @@ RingClientUWP::RingD::startDaemon()
DRing::fini(); DRing::fini();
} }
}); });
});
} }
RingClientUWP::RingD::RingD() RingClientUWP::RingD::RingD()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment