mirror of
https://github.com/lubosz/overte.git
synced 2025-04-09 06:04:42 +02:00
Merge pull request #8731 from huffman/feat/interface-run-server
Add flag to interface to have it start the sandbox server
This commit is contained in:
commit
80ecf88935
1 changed files with 24 additions and 0 deletions
|
@ -29,6 +29,7 @@
|
|||
#include "InterfaceLogging.h"
|
||||
#include "UserActivityLogger.h"
|
||||
#include "MainWindow.h"
|
||||
#include <QtCore/QProcess>
|
||||
|
||||
#ifdef HAS_BUGSPLAT
|
||||
#include <BuildInfo.h>
|
||||
|
@ -121,6 +122,29 @@ int main(int argc, const char* argv[]) {
|
|||
}
|
||||
}
|
||||
|
||||
QCommandLineParser parser;
|
||||
QCommandLineOption runServerOption("runServer", "Whether to run the server");
|
||||
QCommandLineOption serverContentPathOption("serverContentPath", "Where to find server content", "serverContentPath");
|
||||
parser.addOption(runServerOption);
|
||||
parser.addOption(serverContentPathOption);
|
||||
parser.parse(arguments);
|
||||
if (parser.isSet(runServerOption)) {
|
||||
QString applicationDirPath = QFileInfo(arguments[0]).path();
|
||||
QString serverPath = applicationDirPath + "/server-console/server-console.exe";
|
||||
qDebug() << "Application dir path is: " << applicationDirPath;
|
||||
qDebug() << "Server path is: " << serverPath;
|
||||
QStringList args;
|
||||
if (parser.isSet(serverContentPathOption)) {
|
||||
QString serverContentPath = QFileInfo(arguments[0]).path() + "/" + parser.value(serverContentPathOption);
|
||||
args << "--" << "--contentPath" << serverContentPath;
|
||||
}
|
||||
qDebug() << QFileInfo(arguments[0]).path();
|
||||
qDebug() << QProcess::startDetached(serverPath, args);
|
||||
|
||||
// Sleep a short amount of time to give the server a chance to start
|
||||
usleep(2000000);
|
||||
}
|
||||
|
||||
QElapsedTimer startupTime;
|
||||
startupTime.start();
|
||||
|
||||
|
|
Loading…
Reference in a new issue