mirror of
https://github.com/overte-org/overte.git
synced 2025-07-10 22:58:43 +02:00
Fix ScriptEngine not properly resolving paths
This commit is contained in:
parent
32db63e177
commit
667a737018
1 changed files with 11 additions and 5 deletions
|
@ -25,6 +25,7 @@
|
||||||
#include <QtNetwork/QNetworkRequest>
|
#include <QtNetwork/QNetworkRequest>
|
||||||
#include <QtNetwork/QNetworkReply>
|
#include <QtNetwork/QNetworkReply>
|
||||||
|
|
||||||
|
#include <QtScript/QScriptContextInfo>
|
||||||
#include <QtScript/QScriptValue>
|
#include <QtScript/QScriptValue>
|
||||||
#include <QtScript/QScriptValueIterator>
|
#include <QtScript/QScriptValueIterator>
|
||||||
|
|
||||||
|
@ -1091,14 +1092,19 @@ QUrl ScriptEngine::resolvePath(const QString& include) const {
|
||||||
return expandScriptUrl(url);
|
return expandScriptUrl(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QScriptContextInfo contextInfo { currentContext()->parentContext() };
|
||||||
|
|
||||||
// we apparently weren't a fully qualified url, so, let's assume we're relative
|
// we apparently weren't a fully qualified url, so, let's assume we're relative
|
||||||
// to the original URL of our script
|
// to the original URL of our script
|
||||||
QUrl parentURL;
|
QUrl parentURL = contextInfo.fileName();
|
||||||
if (_parentURL.isEmpty()) {
|
if (parentURL.isEmpty()) {
|
||||||
parentURL = QUrl(_fileNameString);
|
if (_parentURL.isEmpty()) {
|
||||||
} else {
|
parentURL = QUrl(_fileNameString);
|
||||||
parentURL = QUrl(_parentURL);
|
} else {
|
||||||
|
parentURL = QUrl(_parentURL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the parent URL's scheme is empty, then this is probably a local file...
|
// if the parent URL's scheme is empty, then this is probably a local file...
|
||||||
if (parentURL.scheme().isEmpty()) {
|
if (parentURL.scheme().isEmpty()) {
|
||||||
parentURL = QUrl::fromLocalFile(_fileNameString);
|
parentURL = QUrl::fromLocalFile(_fileNameString);
|
||||||
|
|
Loading…
Reference in a new issue