Showing the changes to libraries/script-engine/src/ScriptEngines.cpp (1 of 8 files). Show all
Unified · Split
| @@ -74,7 +74,7 @@ ScriptEngines::ScriptEngines(ScriptEngine::Context context) · 73 unmodified lines | ||
| 74 | 74 | QUrl normalizeScriptURL(const QUrl& rawScriptURL) { |
| 75 | 75 | if (rawScriptURL.scheme() == "file") { |
| 76 | 76 | QUrl fullNormal = rawScriptURL; |
| 77 | − QUrl defaultScriptLoc = defaultScriptsLocation(); | |
| 77 | + QUrl defaultScriptLoc = PathUtils::defaultScriptsLocation(); | |
| 78 | 78 | |
| 79 | 79 | // if this url is something "beneath" the default script url, replace the local path with ~ |
| 80 | 80 | if (fullNormal.scheme() == defaultScriptLoc.scheme() && |
| @@ -93,7 +93,7 @@ QUrl normalizeScriptURL(const QUrl& rawScriptURL) { · 12 unmodified lines | ||
| 93 | 93 | |
| 94 | 94 | QString expandScriptPath(const QString& rawPath) { |
| 95 | 95 | QStringList splitPath = rawPath.split("/"); |
| 96 | − QUrl defaultScriptsLoc = defaultScriptsLocation(); | |
| 96 | + QUrl defaultScriptsLoc = PathUtils::defaultScriptsLocation(); | |
| 97 | 97 | return defaultScriptsLoc.path() + "/" + splitPath.mid(2).join("/"); // 2 to skip the slashes in /~/ |
| 98 | 98 | } |
| 99 | 99 | |
| @@ -112,7 +112,7 @@ QUrl expandScriptUrl(const QUrl& rawScriptURL) { · 12 unmodified lines | ||
| 112 | 112 | QFileInfo fileInfo(url.toLocalFile()); |
| 113 | 113 | url = QUrl::fromLocalFile(fileInfo.canonicalFilePath()); |
| 114 | 114 | |
| 115 | − QUrl defaultScriptsLoc = defaultScriptsLocation(); | |
| 115 | + QUrl defaultScriptsLoc = PathUtils::defaultScriptsLocation(); | |
| 116 | 116 | if (!defaultScriptsLoc.isParentOf(url)) { |
| 117 | 117 | qCWarning(scriptengine) << "Script.include() ignoring file path" << rawScriptURL |
| 118 | 118 | << "-- outside of standard libraries: " |
| @@ -327,6 +327,13 @@ void ScriptEngines::saveScripts() { · 208 unmodified lines | ||
| 327 | 327 | return; |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | + // don't save scripts if we started with --scripts, as we would overwrite | |
| 331 | + // the scripts that the user expects to be there when launched without the | |
| 332 | + // --scripts override. | |
| 333 | + if (_defaultScriptsLocationOverridden) { | |
| 334 | + return; | |
| 335 | + } | |
| 336 | + | |
| 330 | 337 | // Saves all currently running user-loaded scripts |
| 331 | 338 | QVariantList list; |
| 332 | 339 | |
| @@ -533,11 +540,11 @@ void ScriptEngines::launchScriptEngine(ScriptEngine* scriptEngine) { · 200 unmodified lines | ||
| 533 | 540 | initializer(scriptEngine); |
| 534 | 541 | } |
| 535 | 542 | |
| 536 | − // FIXME disabling 'shift key' debugging for now. If you start up the application with | |
| 537 | − // the shift key held down, it triggers a deadlock because of script interfaces running | |
| 543 | + // FIXME disabling 'shift key' debugging for now. If you start up the application with | |
| 544 | + // the shift key held down, it triggers a deadlock because of script interfaces running | |
| 538 | 545 | // on the main thread |
| 539 | 546 | auto const wantDebug = scriptEngine->isDebuggable(); // || (qApp->queryKeyboardModifiers() & Qt::ShiftModifier); |
| 540 | − | |
| 547 | + | |
| 541 | 548 | if (HIFI_SCRIPT_DEBUGGABLES && wantDebug) { |
| 542 | 549 | scriptEngine->runDebuggable(); |
| 543 | 550 | } else { |
| @@ -573,5 +580,5 @@ void ScriptEngines::onScriptEngineError(const QString& scriptFilename) { · 29 unmodified lines | ||
| 573 | 580 | } |
| 574 | 581 | |
| 575 | 582 | QString ScriptEngines::getDefaultScriptsLocation() const { |
| 576 | − return defaultScriptsLocation().toString(); | |
| 583 | + return PathUtils::defaultScriptsLocation().toString(); | |
| 577 | 584 | } |