Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 1 file). Show all
Unified · Split
| @@ -107,6 +107,7 @@ void inputControllerFromScriptValue(const QScriptValue &object, controller::Inpu · 106 unmodified lines | |||
| 107 | out = qobject_cast<controller::InputController*>(object.toQObject()); | 107 | out = qobject_cast<controller::InputController*>(object.toQObject()); |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | // FIXME Come up with a way to properly encode entity IDs in filename | ||
| 110 | // The purpose of the following two function is to embed entity ids into entity script filenames | 111 | // The purpose of the following two function is to embed entity ids into entity script filenames |
| 111 | // so that they show up in stacktraces | 112 | // so that they show up in stacktraces |
| 112 | // | 113 | // |
| @@ -1113,9 +1114,10 @@ QUrl ScriptEngine::resolvePath(const QString& include) const { · 1000 unmodified lines | |||
| 1113 | 1114 | ||
| 1114 | QScriptContextInfo contextInfo { currentContext()->parentContext() }; | 1115 | QScriptContextInfo contextInfo { currentContext()->parentContext() }; |
| 1115 | 1116 | ||
| 1117 | |||
| 1116 | // we apparently weren't a fully qualified url, so, let's assume we're relative | 1118 | // we apparently weren't a fully qualified url, so, let's assume we're relative |
| 1117 | // to the original URL of our script | 1119 | // to the original URL of our script |
| 1118 | QUrl parentURL = extractUrlFromEntityUrl(contextInfo.fileName()); | 1120 | QUrl parentURL = contextInfo.fileName(); |
| 1119 | if (parentURL.isEmpty()) { | 1121 | if (parentURL.isEmpty()) { |
| 1120 | if (_parentURL.isEmpty()) { | 1122 | if (_parentURL.isEmpty()) { |
| 1121 | parentURL = QUrl(_fileNameString); | 1123 | parentURL = QUrl(_fileNameString); |
| @@ -1348,7 +1350,7 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co · 226 unmodified lines | |||
| 1348 | 1350 | ||
| 1349 | auto scriptCache = DependencyManager::get<ScriptCache>(); | 1351 | auto scriptCache = DependencyManager::get<ScriptCache>(); |
| 1350 | bool isFileUrl = isURL && scriptOrURL.startsWith("file://"); | 1352 | bool isFileUrl = isURL && scriptOrURL.startsWith("file://"); |
| 1351 | auto fileName = isURL ? encodeEntityIdIntoEntityUrl(scriptOrURL, entityID.toString()) : "EmbeddedEntityScript"; | 1353 | auto fileName = isURL ? scriptOrURL : "EmbeddedEntityScript"; |
| 1352 | 1354 | ||
| 1353 | QScriptProgram program(contents, fileName); | 1355 | QScriptProgram program(contents, fileName); |
| 1354 | if (!hasCorrectSyntax(program)) { | 1356 | if (!hasCorrectSyntax(program)) { |