Showing the changes to libraries/script-engine/src/AssetScriptingInterface.cpp (1 of 5 files). Show all
Unified · Split
| @@ -75,28 +75,6 @@ void AssetScriptingInterface::setMapping(QString path, QString hash, QScriptValu · 74 unmodified lines | ||
| 75 | 75 | setMappingRequest->start(); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | −void AssetScriptingInterface::getMapping(QString path, QScriptValue callback) { | |
| 79 | − auto request = DependencyManager::get<AssetClient>()->createGetMappingRequest(path); | |
| 80 | − QObject::connect(request, &GetMappingRequest::finished, this, [=](GetMappingRequest* request) mutable { | |
| 81 | − auto result = request->getError(); | |
| 82 | − if (callback.isFunction()) { | |
| 83 | − if (result == GetMappingRequest::NotFound) { | |
| 84 | − QScriptValueList args { "", true }; | |
| 85 | − callback.call(_engine->currentContext()->thisObject(), args); | |
| 86 | − } else if (result == GetMappingRequest::NoError) { | |
| 87 | − QScriptValueList args { request->getHash(), true }; | |
| 88 | − callback.call(_engine->currentContext()->thisObject(), args); | |
| 89 | − } else { | |
| 90 | − qCDebug(scriptengine) << "error -- " << request->getError() << " -- " << request->getErrorString(); | |
| 91 | − QScriptValueList args { "", false }; | |
| 92 | − callback.call(_engine->currentContext()->thisObject(), args); | |
| 93 | − } | |
| 94 | − request->deleteLater(); | |
| 95 | − } | |
| 96 | − }); | |
| 97 | − request->start(); | |
| 98 | −} | |
| 99 | − | |
| 100 | 78 | void AssetScriptingInterface::downloadData(QString urlString, QScriptValue callback) { |
| 101 | 79 | // FIXME: historically this API method failed silently when given a non-atp prefixed |
| 102 | 80 | // urlString (or if the AssetRequest failed). |