diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index bcf6394362..18d7b0ebf1 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -107,6 +107,25 @@ void inputControllerFromScriptValue(const QScriptValue &object, controller::Inpu out = qobject_cast(object.toQObject()); } +// The purpose of the following two function is to embed entity ids into entity script filenames +// so that they show up in stacktraces +// +// Extract the url portion of a url that has been encoded with encodeEntityIdIntoEntityUrl(...) +QString extractUrlFromEntityUrl(const QString& url) { + auto parts = url.split(' ', QString::SkipEmptyParts); + if (parts.length() > 0) { + return parts[0]; + } else { + return ""; + } +} + +// Encode an entity id into an entity url +// Example: http://www.example.com/some/path.js [EntityID:{9fdd355f-d226-4887-9484-44432d29520e}] +QString encodeEntityIdIntoEntityUrl(const QString& url, const QString& entityID) { + return url + " [EntityID:" + entityID + "]"; +} + static bool hasCorrectSyntax(const QScriptProgram& program) { const auto syntaxCheck = QScriptEngine::checkSyntax(program.sourceCode()); if (syntaxCheck.state() != QScriptSyntaxCheckResult::Valid) { @@ -1303,25 +1322,6 @@ void ScriptEngine::loadEntityScript(QWeakPointer theEngine, const }, forceRedownload); } -// The purpose of the following two function is to embed entity ids into entity script filenames -// so that they show up in stacktraces -// -// Extract the url portion of a url that has been encoded with encodeEntityIdIntoEntityUrl(...) -QString extractUrlFromEntityUrl(const QString& url) { - auto parts = url.split(' ', QString::SkipEmptyParts); - if (parts.length() > 0) { - return parts[0]; - } else { - return ""; - } -} - -// Encode an entity id into an entity url -// Example: http://www.example.com/some/path.js [EntityID:{9fdd355f-d226-4887-9484-44432d29520e}] -QString encodeEntityIdIntoEntityUrl(const QString& url, const QString& entityID) { - return url + " [EntityID:" + entityID + "]"; -} - // since all of these operations can be asynch we will always do the actual work in the response handler // for the download void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, const QString& scriptOrURL, const QString& contents, bool isURL, bool success) {