From f34cf64f3e4d19eb9c9c48b61c56988e2760d016 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Mon, 7 Nov 2016 15:41:43 -0800 Subject: [PATCH] Disable updater on Steam --- interface/src/Application.cpp | 12 ++++++++---- libraries/networking/src/SandboxUtils.cpp | 9 +++++++-- libraries/networking/src/SandboxUtils.h | 2 +- server-console/src/main.js | 6 +++++- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 867761e012..ea34f9fed5 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -599,7 +599,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo qCDebug(interfaceapp) << "Home sandbox does not appear to be running...."; if (wantsSandboxRunning) { QString contentPath = getRunServerPath(); - SandboxUtils::runLocalSandbox(contentPath, true, RUNNING_MARKER_FILENAME); + bool noUpdater = SteamClient::isRunning(); + SandboxUtils::runLocalSandbox(contentPath, true, RUNNING_MARKER_FILENAME, noUpdater); sandboxIsRunning = true; } determinedSandboxState = true; @@ -1119,9 +1120,12 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo setActiveEyeTracker(); #endif - auto applicationUpdater = DependencyManager::get(); - connect(applicationUpdater.data(), &AutoUpdater::newVersionIsAvailable, dialogsManager.data(), &DialogsManager::showUpdateDialog); - applicationUpdater->checkForUpdate(); + // If launched from Steam, let it handle updates + if (!SteamClient::isRunning()) { + auto applicationUpdater = DependencyManager::get(); + connect(applicationUpdater.data(), &AutoUpdater::newVersionIsAvailable, dialogsManager.data(), &DialogsManager::showUpdateDialog); + applicationUpdater->checkForUpdate(); + } // Now that menu is initialized we can sync myAvatar with it's state. myAvatar->updateMotionBehaviorFromMenu(); diff --git a/libraries/networking/src/SandboxUtils.cpp b/libraries/networking/src/SandboxUtils.cpp index 98c963b793..b16c169baa 100644 --- a/libraries/networking/src/SandboxUtils.cpp +++ b/libraries/networking/src/SandboxUtils.cpp @@ -61,15 +61,16 @@ void SandboxUtils::ifLocalSandboxRunningElse(std::function localSandboxR } -void SandboxUtils::runLocalSandbox(QString contentPath, bool autoShutdown, QString runningMarkerName) { +void SandboxUtils::runLocalSandbox(QString contentPath, bool autoShutdown, QString runningMarkerName, bool noUpdater) { QString applicationDirPath = QFileInfo(QCoreApplication::applicationFilePath()).path(); QString serverPath = applicationDirPath + "/server-console/server-console.exe"; qDebug() << "Application dir path is: " << applicationDirPath; qDebug() << "Server path is: " << serverPath; qDebug() << "autoShutdown: " << autoShutdown; + qDebug() << "noUpdater: " << noUpdater; bool hasContentPath = !contentPath.isEmpty(); - bool passArgs = autoShutdown || hasContentPath; + bool passArgs = autoShutdown || hasContentPath || noUpdater; QStringList args; @@ -87,6 +88,10 @@ void SandboxUtils::runLocalSandbox(QString contentPath, bool autoShutdown, QStri args << "--shutdownWatcher" << interfaceRunningStateFile; } + if (noUpdater) { + args << "--noUpdater"; + } + qDebug() << applicationDirPath; qDebug() << "Launching sandbox with:" << args; qDebug() << QProcess::startDetached(serverPath, args); diff --git a/libraries/networking/src/SandboxUtils.h b/libraries/networking/src/SandboxUtils.h index e40ff71a56..aaceafb9ef 100644 --- a/libraries/networking/src/SandboxUtils.h +++ b/libraries/networking/src/SandboxUtils.h @@ -26,7 +26,7 @@ public: void ifLocalSandboxRunningElse(std::function localSandboxRunningDoThis, std::function localSandboxNotRunningDoThat); - static void runLocalSandbox(QString contentPath, bool autoShutdown, QString runningMarkerName); + static void runLocalSandbox(QString contentPath, bool autoShutdown, QString runningMarkerName, bool noUpdater); }; #endif // hifi_SandboxUtils_h diff --git a/server-console/src/main.js b/server-console/src/main.js index 6c82230601..dce28a667d 100644 --- a/server-console/src/main.js +++ b/server-console/src/main.js @@ -579,6 +579,10 @@ function backupResourceDirectoriesAndRestart() { } function checkNewContent() { + if (argv.noUpdater) { + return; + } + // Start downloading content set var req = request.head({ url: HOME_CONTENT_URL @@ -817,7 +821,7 @@ function onContentLoaded() { // Disable splash window for now. // maybeShowSplash(); - if (buildInfo.releaseType == 'PRODUCTION') { + if (buildInfo.releaseType == 'PRODUCTION' && !argv.noUpdater) { var currentVersion = null; try { currentVersion = parseInt(buildInfo.buildIdentifier);