From 392ecb0dae3e0f2c7a7bead747e85297af364cc6 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 23 Sep 2016 16:41:44 -0700 Subject: [PATCH] Update interface to launch server --- interface/src/main.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/interface/src/main.cpp b/interface/src/main.cpp index 527b7f2331..3fc09636ed 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -29,6 +29,7 @@ #include "InterfaceLogging.h" #include "UserActivityLogger.h" #include "MainWindow.h" +#include #ifdef HAS_BUGSPLAT #include @@ -121,6 +122,27 @@ int main(int argc, const char* argv[]) { } } + QCommandLineParser parser; + QCommandLineOption runServer("runServer", "Whether to run the server"); + QCommandLineOption serverContentPath("serverContentPath", "Where to find server content", "serverContentPath"); + parser.addOption(runServer); + parser.addOption(serverContentPath); + parser.parse(arguments); + if (parser.isSet(runServer)) { + QString serverPath = QFileInfo(arguments[0]).path(); + serverPath += "/server-console/server-console.exe"; + //serverPath = "./server-console/server-console.exe"; + QStringList args; + if (parser.isSet(serverContentPath)) { + args << "--" << "--contentPath" << parser.value(serverContentPath); + } + qDebug() << "server path: " << serverPath << args; + qDebug() << QFileInfo(arguments[0]).path(); + qDebug() << QProcess::startDetached(serverPath, args); + + usleep(2000000); + } + QElapsedTimer startupTime; startupTime.start();