mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 04:44:11 +02:00
Merge pull request #8752 from huffman/fix/script-resolve
Fix script paths not resolving correctly
This commit is contained in:
commit
b1cd553074
1 changed files with 4 additions and 2 deletions
|
@ -107,6 +107,7 @@ void inputControllerFromScriptValue(const QScriptValue &object, controller::Inpu
|
|||
out = qobject_cast<controller::InputController*>(object.toQObject());
|
||||
}
|
||||
|
||||
// FIXME Come up with a way to properly encode entity IDs in filename
|
||||
// The purpose of the following two function is to embed entity ids into entity script filenames
|
||||
// so that they show up in stacktraces
|
||||
//
|
||||
|
@ -1113,9 +1114,10 @@ QUrl ScriptEngine::resolvePath(const QString& include) const {
|
|||
|
||||
QScriptContextInfo contextInfo { currentContext()->parentContext() };
|
||||
|
||||
|
||||
// we apparently weren't a fully qualified url, so, let's assume we're relative
|
||||
// to the original URL of our script
|
||||
QUrl parentURL = extractUrlFromEntityUrl(contextInfo.fileName());
|
||||
QUrl parentURL = contextInfo.fileName();
|
||||
if (parentURL.isEmpty()) {
|
||||
if (_parentURL.isEmpty()) {
|
||||
parentURL = QUrl(_fileNameString);
|
||||
|
@ -1348,7 +1350,7 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co
|
|||
|
||||
auto scriptCache = DependencyManager::get<ScriptCache>();
|
||||
bool isFileUrl = isURL && scriptOrURL.startsWith("file://");
|
||||
auto fileName = isURL ? encodeEntityIdIntoEntityUrl(scriptOrURL, entityID.toString()) : "EmbeddedEntityScript";
|
||||
auto fileName = isURL ? scriptOrURL : "EmbeddedEntityScript";
|
||||
|
||||
QScriptProgram program(contents, fileName);
|
||||
if (!hasCorrectSyntax(program)) {
|
||||
|
|
Loading…
Reference in a new issue