History

reuse same disk cache as AssetClient

humbletim committed 8 years ago

Commit 395cc661 parent 31cdd5c5 files · +128 −115Browse files

Showing the changes to libraries/script-engine/src/AssetScriptingInterface.cpp (1 of 5 files). Show all

Unified · Split

libraries/script-engine/src/AssetScriptingInterface.cpp+0−22
@@ -75,28 +75,6 @@ void AssetScriptingInterface::setMapping(QString path, QString hash, QScriptValu · 74 unmodified lines
75 setMappingRequest->start();75 setMappingRequest->start();
76}76}
77 77
78void 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
100void AssetScriptingInterface::downloadData(QString urlString, QScriptValue callback) {78void AssetScriptingInterface::downloadData(QString urlString, QScriptValue callback) {
101 // FIXME: historically this API method failed silently when given a non-atp prefixed79 // FIXME: historically this API method failed silently when given a non-atp prefixed
102 // urlString (or if the AssetRequest failed).80 // urlString (or if the AssetRequest failed).