aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/barrier/win32/DaemonApp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/barrier/win32/DaemonApp.cpp')
-rw-r--r--src/lib/barrier/win32/DaemonApp.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/lib/barrier/win32/DaemonApp.cpp b/src/lib/barrier/win32/DaemonApp.cpp
index 482c465..81ec5ff 100644
--- a/src/lib/barrier/win32/DaemonApp.cpp
+++ b/src/lib/barrier/win32/DaemonApp.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2012 Nick Bolton
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -28,7 +28,6 @@
#include "net/SocketMultiplexer.h"
#include "arch/XArch.h"
#include "base/Log.h"
-#include "base/TMethodJob.h"
#include "base/TMethodEventJob.h"
#include "base/EventQueue.h"
#include "base/log_outputters.h"
@@ -87,7 +86,7 @@ DaemonApp::run(int argc, char** argv)
{
// win32 instance needed for threading, etc.
ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL));
-
+
Arch arch;
arch.init();
@@ -174,7 +173,7 @@ DaemonApp::mainLoop(bool daemonized)
try
{
DAEMON_RUNNING(true);
-
+
if (daemonized) {
m_fileLogOutputter = new FileLogOutputter(logFilename().c_str());
CLOG->insert(m_fileLogOutputter);
@@ -190,19 +189,19 @@ DaemonApp::mainLoop(bool daemonized)
// send logging to gui via ipc, log system adopts outputter.
m_ipcLogOutputter = new IpcLogOutputter(*m_ipcServer, kIpcClientGui, true);
CLOG->insert(m_ipcLogOutputter);
-
+
m_watchdog = new MSWindowsWatchdog(daemonized, false, *m_ipcServer, *m_ipcLogOutputter);
m_watchdog->setFileLogOutputter(m_fileLogOutputter);
-
+
m_events->adoptHandler(
m_events->forIpcServer().messageReceived(), m_ipcServer,
new TMethodEventJob<DaemonApp>(this, &DaemonApp::handleIpcMessage));
m_ipcServer->listen();
-
+
// install the platform event queue to handle service stop events.
m_events->adoptBuffer(new MSWindowsEventQueueBuffer(m_events));
-
+
String command = ARCH->setting("Command");
bool elevate = ARCH->setting("Elevate") == "1";
if (command != "") {
@@ -219,11 +218,11 @@ DaemonApp::mainLoop(bool daemonized)
m_events->removeHandler(
m_events->forIpcServer().messageReceived(), m_ipcServer);
-
+
CLOG->remove(m_ipcLogOutputter);
delete m_ipcLogOutputter;
delete m_ipcServer;
-
+
DAEMON_RUNNING(false);
}
catch (std::exception& e) {
@@ -245,7 +244,7 @@ DaemonApp::logFilename()
{
string logFilename = ARCH->setting("LogFilename");
if (logFilename.empty())
- logFilename = DataDirectories::global() + "\\" + LOG_FILENAME;
+ logFilename = (barrier::DataDirectories::global() / LOG_FILENAME).u8string();
MSWindowsUtil::createDirectory(logFilename, true);
return logFilename;
}
@@ -287,7 +286,7 @@ DaemonApp::handleIpcMessage(const Event& e, void*)
}
delete[] argv;
-
+
String logLevel(argBase->m_logFilter);
if (!logLevel.empty()) {
try {