mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 11:17:34 +02:00
Merge pull request #10836 from davidkelly/dk/scriptsSwitchBug
minor fix for --scripts switch
This commit is contained in:
commit
3606418a22
3 changed files with 20 additions and 6 deletions
|
@ -915,11 +915,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
_saveAvatarOverrideUrl = true;
|
_saveAvatarOverrideUrl = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString defaultScriptsLocation = getCmdOption(argc, constArgv, "--scripts");
|
|
||||||
if (!defaultScriptsLocation.isEmpty()) {
|
|
||||||
PathUtils::defaultScriptsLocation(defaultScriptsLocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
_glWidget = new GLCanvas();
|
_glWidget = new GLCanvas();
|
||||||
getApplicationCompositor().setRenderingWidget(_glWidget);
|
getApplicationCompositor().setRenderingWidget(_glWidget);
|
||||||
_window->setCentralWidget(_glWidget);
|
_window->setCentralWidget(_glWidget);
|
||||||
|
@ -1186,7 +1181,13 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
// do this as late as possible so that all required subsystems are initialized
|
// do this as late as possible so that all required subsystems are initialized
|
||||||
// If we've overridden the default scripts location, just load default scripts
|
// If we've overridden the default scripts location, just load default scripts
|
||||||
// otherwise, load 'em all
|
// otherwise, load 'em all
|
||||||
if (!defaultScriptsLocation.isEmpty()) {
|
|
||||||
|
// we just want to see if --scripts was set, we've already parsed it and done
|
||||||
|
// the change in PathUtils. Rather than pass that in the constructor, lets just
|
||||||
|
// look (this could be debated)
|
||||||
|
QString scriptsSwitch = QString("--").append(SCRIPTS_SWITCH);
|
||||||
|
QDir defaultScriptsLocation(getCmdOption(argc, constArgv, scriptsSwitch.toStdString().c_str()));
|
||||||
|
if (!defaultScriptsLocation.exists()) {
|
||||||
scriptEngines->loadDefaultScripts();
|
scriptEngines->loadDefaultScripts();
|
||||||
scriptEngines->defaultScriptsLocationOverridden(true);
|
scriptEngines->defaultScriptsLocationOverridden(true);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -95,6 +95,7 @@ static const UINT UWM_SHOW_APPLICATION =
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const QString RUNNING_MARKER_FILENAME = "Interface.running";
|
static const QString RUNNING_MARKER_FILENAME = "Interface.running";
|
||||||
|
static const QString SCRIPTS_SWITCH = "scripts";
|
||||||
|
|
||||||
class Application;
|
class Application;
|
||||||
#if defined(qApp)
|
#if defined(qApp)
|
||||||
|
|
|
@ -73,12 +73,14 @@ int main(int argc, const char* argv[]) {
|
||||||
QCommandLineOption serverContentPathOption("serverContentPath", "Where to find server content", "serverContentPath");
|
QCommandLineOption serverContentPathOption("serverContentPath", "Where to find server content", "serverContentPath");
|
||||||
QCommandLineOption allowMultipleInstancesOption("allowMultipleInstances", "Allow multiple instances to run");
|
QCommandLineOption allowMultipleInstancesOption("allowMultipleInstances", "Allow multiple instances to run");
|
||||||
QCommandLineOption overrideAppLocalDataPathOption("cache", "set test cache <dir>", "dir");
|
QCommandLineOption overrideAppLocalDataPathOption("cache", "set test cache <dir>", "dir");
|
||||||
|
QCommandLineOption overrideScriptsPathOption(SCRIPTS_SWITCH, "set scripts <path>", "path");
|
||||||
parser.addOption(urlOption);
|
parser.addOption(urlOption);
|
||||||
parser.addOption(noUpdaterOption);
|
parser.addOption(noUpdaterOption);
|
||||||
parser.addOption(checkMinSpecOption);
|
parser.addOption(checkMinSpecOption);
|
||||||
parser.addOption(runServerOption);
|
parser.addOption(runServerOption);
|
||||||
parser.addOption(serverContentPathOption);
|
parser.addOption(serverContentPathOption);
|
||||||
parser.addOption(overrideAppLocalDataPathOption);
|
parser.addOption(overrideAppLocalDataPathOption);
|
||||||
|
parser.addOption(overrideScriptsPathOption);
|
||||||
parser.addOption(allowMultipleInstancesOption);
|
parser.addOption(allowMultipleInstancesOption);
|
||||||
parser.parse(arguments);
|
parser.parse(arguments);
|
||||||
|
|
||||||
|
@ -99,6 +101,16 @@ int main(int argc, const char* argv[]) {
|
||||||
if (allowMultipleInstances) {
|
if (allowMultipleInstances) {
|
||||||
instanceMightBeRunning = false;
|
instanceMightBeRunning = false;
|
||||||
}
|
}
|
||||||
|
// this needs to be done here in main, as the mechanism for setting the
|
||||||
|
// scripts directory appears not to work. See the bug report
|
||||||
|
// https://highfidelity.fogbugz.com/f/cases/5759/Issues-changing-scripts-directory-in-ScriptsEngine
|
||||||
|
if (parser.isSet(overrideScriptsPathOption)) {
|
||||||
|
QDir scriptsPath(parser.value(overrideScriptsPathOption));
|
||||||
|
if (scriptsPath.exists()) {
|
||||||
|
PathUtils::defaultScriptsLocation(scriptsPath.path());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (parser.isSet(overrideAppLocalDataPathOption)) {
|
if (parser.isSet(overrideAppLocalDataPathOption)) {
|
||||||
// get dir to use for cache
|
// get dir to use for cache
|
||||||
QString cacheDir = parser.value(overrideAppLocalDataPathOption);
|
QString cacheDir = parser.value(overrideAppLocalDataPathOption);
|
||||||
|
|
Loading…
Reference in a new issue