mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 05:58:27 +02:00
launching interface for mac and windows
This commit is contained in:
parent
9265e9da3e
commit
7d6404b40b
3 changed files with 60 additions and 45 deletions
|
@ -131,6 +131,7 @@ set(src_files
|
||||||
src/Unzipper.h
|
src/Unzipper.h
|
||||||
src/Unzipper.cpp
|
src/Unzipper.cpp
|
||||||
src/Helper.h
|
src/Helper.h
|
||||||
|
src/Helper.cpp
|
||||||
deps/miniz/miniz.h
|
deps/miniz/miniz.h
|
||||||
deps/miniz/miniz.cpp
|
deps/miniz/miniz.cpp
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,5 +1,49 @@
|
||||||
#include "Helper.h"
|
#include "Helper.h"
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
#include <Windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(Q_OS_WIN)
|
||||||
void launchClient(const QString& homePath, const QString& defaultScriptOverride, const QString& displayName,
|
void launchClient(const QString& homePath, const QString& defaultScriptOverride, const QString& displayName,
|
||||||
const QString& contentCachePath, const QString& loginResponseToken) {
|
const QString& contentCachePath, const QString& loginResponseToken) {
|
||||||
|
|
||||||
|
// TODO Fix parameters
|
||||||
|
QString params = "--url " + homePath
|
||||||
|
+ " --setBookmark hqhome=\"" + homePath + "\""
|
||||||
|
+ " --defaultScriptsOverride " + defaultScriptsPath
|
||||||
|
+ " --displayName " + displayName
|
||||||
|
+ " --cache " + contentCachePath;
|
||||||
|
|
||||||
|
if (!_loginTokenResponse.isEmpty()) {
|
||||||
|
params += " --tokens \"" + _loginTokenResponse.replace("\"", "\\\"") + "\"";
|
||||||
|
}
|
||||||
|
|
||||||
|
STARTUPINFO si;
|
||||||
|
PROCESS_INFORMATION pi;
|
||||||
|
|
||||||
|
// set the size of the structures
|
||||||
|
ZeroMemory(&si, sizeof(si));
|
||||||
|
si.cb = sizeof(si);
|
||||||
|
ZeroMemory(&pi, sizeof(pi));
|
||||||
|
|
||||||
|
// start the program up
|
||||||
|
BOOL success = CreateProcess(
|
||||||
|
clientPath.toUtf8().data(),
|
||||||
|
params.toUtf8().data(),
|
||||||
|
nullptr, // Process handle not inheritable
|
||||||
|
nullptr, // Thread handle not inheritable
|
||||||
|
FALSE, // Set handle inheritance to FALSE
|
||||||
|
CREATE_NEW_CONSOLE, // Opens file in a separate console
|
||||||
|
nullptr, // Use parent's environment block
|
||||||
|
nullptr, // Use parent's starting directory
|
||||||
|
&si, // Pointer to STARTUPINFO structure
|
||||||
|
&pi // Pointer to PROCESS_INFORMATION structure
|
||||||
|
);
|
||||||
|
// Close process and thread handles.
|
||||||
|
CloseHandle(pi.hProcess);
|
||||||
|
CloseHandle(pi.hThread);
|
||||||
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -416,56 +416,26 @@ void LauncherState::launchClient() {
|
||||||
setApplicationState(ApplicationState::LaunchingHighFidelity);
|
setApplicationState(ApplicationState::LaunchingHighFidelity);
|
||||||
|
|
||||||
QDir installDirectory = _launcherDirectory.filePath("interface_install");
|
QDir installDirectory = _launcherDirectory.filePath("interface_install");
|
||||||
auto clientPath = installDirectory.absoluteFilePath("interface.app/Contents/MacOS/interface");
|
QString clientPath;
|
||||||
|
#if defined(Q_OS_WIN)
|
||||||
|
clientPath = installDirectory.absoluteFilePath("interface.exe");
|
||||||
|
#elif defined(Q_OS_MACOS)
|
||||||
|
clientPath = installDirectory.absoluteFilePath("interface.app/Contents/MacOS/interface");
|
||||||
|
#endif
|
||||||
|
|
||||||
QString homePath = "hifi://hq";
|
QString homePath = "hifi://hq";
|
||||||
QString defaultScriptsPath = installDirectory.filePath("scripts/simplifiedUIBootstrapper");
|
QString defaultScriptsPath;
|
||||||
|
#if defined(Q_OS_WIN)
|
||||||
|
defaultScriptsPath = installDirectory.filePath("scripts/simplifiedUIBootstrapper.js");
|
||||||
|
#elif defined(Q_OS_MACOS)
|
||||||
|
defaultScriptsPath = installDirectory.filePath("interface.app/Contents/Resources/scripts/simplifiedUIBootstrapper.js");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
qDebug() << "------> " << defaultScriptsPath;
|
||||||
QString displayName = "fixMe";
|
QString displayName = "fixMe";
|
||||||
QString contentCachePath = _launcherDirectory.filePath("cache");
|
QString contentCachePath = _launcherDirectory.filePath("cache");
|
||||||
|
|
||||||
//::launchClient(clientPath, homePath, defaultScriptsPath, displayName, contentCachePath, _loginTokenResponse);
|
::launchClient(clientPath, homePath, QDir::toNativeSeparators(defaultScriptsPath), displayName, contentCachePath, _loginTokenResponse);
|
||||||
/* // TODO Fix parameters
|
|
||||||
QString params = "--url " + homePath
|
|
||||||
+ " --setBookmark hqhome=\"" + homePath + "\""
|
|
||||||
+ " --defaultScriptsOverride " + QDir::toNativeSeparators(defaultScriptsPath)
|
|
||||||
+ " --displayName " + displayName
|
|
||||||
+ " --cache " + contentCachePath;
|
|
||||||
|
|
||||||
if (!_loginTokenResponse.isEmpty()) {
|
|
||||||
params += " --tokens \"" + _loginTokenResponse.replace("\"", "\\\"") + "\"";
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
|
||||||
STARTUPINFO si;
|
|
||||||
PROCESS_INFORMATION pi;
|
|
||||||
|
|
||||||
// set the size of the structures
|
|
||||||
ZeroMemory(&si, sizeof(si));
|
|
||||||
si.cb = sizeof(si);
|
|
||||||
ZeroMemory(&pi, sizeof(pi));
|
|
||||||
|
|
||||||
// start the program up
|
|
||||||
BOOL success = CreateProcess(
|
|
||||||
clientPath.toUtf8().data(),
|
|
||||||
params.toUtf8().data(),
|
|
||||||
nullptr, // Process handle not inheritable
|
|
||||||
nullptr, // Thread handle not inheritable
|
|
||||||
FALSE, // Set handle inheritance to FALSE
|
|
||||||
CREATE_NEW_CONSOLE, // Opens file in a separate console
|
|
||||||
nullptr, // Use parent's environment block
|
|
||||||
nullptr, // Use parent's starting directory
|
|
||||||
&si, // Pointer to STARTUPINFO structure
|
|
||||||
&pi // Pointer to PROCESS_INFORMATION structure
|
|
||||||
);
|
|
||||||
// Close process and thread handles.
|
|
||||||
CloseHandle(pi.hProcess);
|
|
||||||
CloseHandle(pi.hThread);
|
|
||||||
exit(0);
|
|
||||||
#elif defined(Q_OS_MACOS)
|
|
||||||
// TODO Implement launching of client
|
|
||||||
#else
|
|
||||||
#error UNSUPPORTED PLATFORM
|
|
||||||
#endif*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherState::setApplicationState(ApplicationState state) {
|
void LauncherState::setApplicationState(ApplicationState state) {
|
||||||
|
|
Loading…
Reference in a new issue