History

Fix script paths not resolving correctly

Ryan Huffman committed 10 years ago

Commit bbd71741 parent 8310a9f1 file · +4 −2Browse files

Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 1 file). Show all

Unified · Split

libraries/script-engine/src/ScriptEngine.cpp+4−2
@@ -107,6 +107,7 @@ void inputControllerFromScriptValue(const QScriptValue &object, controller::Inpu · 106 unmodified lines
107107 out = qobject_cast<controller::InputController*>(object.toQObject());
108108 }
109109
110+// FIXME Come up with a way to properly encode entity IDs in filename
110111 // The purpose of the following two function is to embed entity ids into entity script filenames
111112 // so that they show up in stacktraces
112113 //
@@ -1113,9 +1114,10 @@ QUrl ScriptEngine::resolvePath(const QString& include) const { · 1000 unmodified lines
11131114
11141115 QScriptContextInfo contextInfo { currentContext()->parentContext() };
11151116
1117+
11161118 // we apparently weren't a fully qualified url, so, let's assume we're relative
11171119 // to the original URL of our script
1118− QUrl parentURL = extractUrlFromEntityUrl(contextInfo.fileName());
1120+ QUrl parentURL = contextInfo.fileName();
11191121 if (parentURL.isEmpty()) {
11201122 if (_parentURL.isEmpty()) {
11211123 parentURL = QUrl(_fileNameString);
@@ -1348,7 +1350,7 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co · 226 unmodified lines
13481350
13491351 auto scriptCache = DependencyManager::get<ScriptCache>();
13501352 bool isFileUrl = isURL && scriptOrURL.startsWith("file://");
1351− auto fileName = isURL ? encodeEntityIdIntoEntityUrl(scriptOrURL, entityID.toString()) : "EmbeddedEntityScript";
1353+ auto fileName = isURL ? scriptOrURL : "EmbeddedEntityScript";
13521354
13531355 QScriptProgram program(contents, fileName);
13541356 if (!hasCorrectSyntax(program)) {