From 3baeac6bac35177e3182eac716e6611592d3a5e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Fri, 24 Jun 2016 21:09:41 +0200 Subject: [PATCH] Set the path of the docs root. --- YACReaderLibrary/server/startup.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/YACReaderLibrary/server/startup.cpp b/YACReaderLibrary/server/startup.cpp index a983ab89..6970c6e9 100644 --- a/YACReaderLibrary/server/startup.cpp +++ b/YACReaderLibrary/server/startup.cpp @@ -82,6 +82,21 @@ void Startup::start() { // Configure static file controller QSettings* fileSettings=new QSettings(configFileName,QSettings::IniFormat,app); fileSettings->beginGroup("docroot"); + + QString basedocroot = "./server/docroot"; + QString docroot; + + #if defined Q_OS_UNIX && ! defined Q_OS_MAC + QFileInfo configFile(QString(DATADIR)+"/yacreader"); + docroot=QFileInfo(QString(DATADIR)+"/yacreader",basedocroot).absoluteFilePath(); + #else + QFileInfo configFile(QCoreApplication::applicationDirPath()); + docroot=QFileInfo(QCoreApplication::applicationDirPath(),basedocroot).absoluteFilePath(); + #endif + + if(fileSettings->value("path").isNull()) + fileSettings->setValue("path",docroot); + Static::staticFileController=new StaticFileController(fileSettings,app); // Configure and start the TCP listener