Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 1 file). Show all
Unified · Split
| @@ -25,6 +25,7 @@ · 24 unmodified lines | |||
| 25 | #include <QtNetwork/QNetworkRequest> | 25 | #include <QtNetwork/QNetworkRequest> |
| 26 | #include <QtNetwork/QNetworkReply> | 26 | #include <QtNetwork/QNetworkReply> |
| 27 | 27 | ||
| 28 | #include <QtScript/QScriptContextInfo> | ||
| 28 | #include <QtScript/QScriptValue> | 29 | #include <QtScript/QScriptValue> |
| 29 | #include <QtScript/QScriptValueIterator> | 30 | #include <QtScript/QScriptValueIterator> |
| 30 | 31 | ||
| @@ -1091,14 +1092,19 @@ QUrl ScriptEngine::resolvePath(const QString& include) const { · 1060 unmodified lines | |||
| 1091 | return expandScriptUrl(url); | 1092 | return expandScriptUrl(url); |
| 1092 | } | 1093 | } |
| 1093 | 1094 | ||
| 1095 | QScriptContextInfo contextInfo { currentContext()->parentContext() }; | ||
| 1096 | |||
| 1094 | // we apparently weren't a fully qualified url, so, let's assume we're relative | 1097 | // we apparently weren't a fully qualified url, so, let's assume we're relative |
| 1095 | // to the original URL of our script | 1098 | // to the original URL of our script |
| 1096 | QUrl parentURL; | 1099 | QUrl parentURL = contextInfo.fileName(); |
| 1097 | if (_parentURL.isEmpty()) { | 1100 | if (parentURL.isEmpty()) { |
| 1098 | parentURL = QUrl(_fileNameString); | 1101 | if (_parentURL.isEmpty()) { |
| 1099 | } else { | 1102 | parentURL = QUrl(_fileNameString); |
| 1100 | parentURL = QUrl(_parentURL); | 1103 | } else { |
| 1104 | parentURL = QUrl(_parentURL); | ||
| 1105 | } | ||
| 1101 | } | 1106 | } |
| 1107 | |||
| 1102 | // if the parent URL's scheme is empty, then this is probably a local file... | 1108 | // if the parent URL's scheme is empty, then this is probably a local file... |
| 1103 | if (parentURL.scheme().isEmpty()) { | 1109 | if (parentURL.scheme().isEmpty()) { |
| 1104 | parentURL = QUrl::fromLocalFile(_fileNameString); | 1110 | parentURL = QUrl::fromLocalFile(_fileNameString); |