mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 06:24:20 +02:00
don't put empty folders at end of scripts tree. allow /~/ to work from outside scripts
This commit is contained in:
parent
8299041997
commit
cfa847ba54
4 changed files with 10 additions and 6 deletions
libraries/script-engine/src
|
@ -18,6 +18,7 @@
|
|||
#include <NetworkAccessManager.h>
|
||||
#include <SharedUtil.h>
|
||||
#include "ResourceManager.h"
|
||||
#include "ScriptEngines.h"
|
||||
|
||||
BatchLoader::BatchLoader(const QList<QUrl>& urls)
|
||||
: QObject(),
|
||||
|
@ -34,8 +35,9 @@ void BatchLoader::start() {
|
|||
}
|
||||
|
||||
_started = true;
|
||||
|
||||
for (const auto& url : _urls) {
|
||||
|
||||
for (const auto& rawURL : _urls) {
|
||||
QUrl url = expandScriptUrl(normalizeScriptURL(rawURL));
|
||||
auto request = ResourceManager::createResourceRequest(this, url);
|
||||
if (!request) {
|
||||
_data.insert(url, QString());
|
||||
|
|
|
@ -220,11 +220,10 @@ void ScriptEngine::loadURL(const QUrl& scriptURL, bool reload) {
|
|||
return;
|
||||
}
|
||||
|
||||
_fileNameString = scriptURL.toString();
|
||||
QUrl url = expandScriptUrl(normalizeScriptURL(scriptURL));
|
||||
_fileNameString = url.toString();
|
||||
_isReloading = reload;
|
||||
|
||||
QUrl url(scriptURL);
|
||||
|
||||
bool isPending;
|
||||
auto scriptCache = DependencyManager::get<ScriptCache>();
|
||||
scriptCache->getScript(url, this, isPending, reload);
|
||||
|
|
|
@ -429,7 +429,7 @@ ScriptEngine* ScriptEngines::loadScript(const QUrl& scriptFilename, bool isUserL
|
|||
connect(scriptEngine, &ScriptEngine::errorLoadingScript, this, &ScriptEngines::onScriptEngineError);
|
||||
|
||||
// get the script engine object to load the script at the designated script URL
|
||||
scriptEngine->loadURL(QUrl(expandScriptUrl(scriptUrl.toString())), reload);
|
||||
scriptEngine->loadURL(scriptUrl, reload);
|
||||
}
|
||||
|
||||
return scriptEngine;
|
||||
|
|
|
@ -309,6 +309,9 @@ void ScriptsModel::rebuildTree() {
|
|||
QString hash;
|
||||
QStringList pathList = script->getLocalPath().split(tr("/"));
|
||||
pathList.removeLast();
|
||||
if (pathList.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
QStringList::const_iterator pathIterator;
|
||||
for (pathIterator = pathList.constBegin(); pathIterator != pathList.constEnd(); ++pathIterator) {
|
||||
hash.append(*pathIterator + "/");
|
||||
|
|
Loading…
Reference in a new issue