History

Downloading blocks from marketplace in own asset folder

Elisa Lupin-Jimenez committed 9 years ago

Commit 1ac95361 parent 17acf054 files · +29 −37Browse files

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

Unified · Split

libraries/script-engine/src/FileScriptingInterface.cpp+8−20
@@ -32,14 +32,11 @@ FileScriptingInterface::FileScriptingInterface(QObject* parent) : QObject(parent · 31 unmodified lines
32 // nothing for now32 // nothing for now
33}33}
34 34
35void FileScriptingInterface::runUnzip(QString path, QUrl url, bool autoAdd, bool isZip) {35void FileScriptingInterface::runUnzip(QString path, QUrl url, bool autoAdd, bool isZip, bool isBlocks) {
36 qCDebug(scriptengine) << "Url that was downloaded: " + url.toString();36 qCDebug(scriptengine) << "Url that was downloaded: " + url.toString();
37 /*if ((url.toString()).contains("vr.google.com/downloads")) {
38
39 path = downloadBlocksZip(url);
40 }*/
41 qCDebug(scriptengine) << "Path where download is saved: " + path;37 qCDebug(scriptengine) << "Path where download is saved: " + path;
42 QString fileName = "/" + path.section("/", -1);38 QString fileName = "/" + path.section("/", -1);
39 qCDebug(scriptengine) << "Filename: " << fileName;
43 QString tempDir = path;40 QString tempDir = path;
44 if (!isZip) {41 if (!isZip) {
45 tempDir.remove(fileName);42 tempDir.remove(fileName);
@@ -60,11 +57,14 @@ void FileScriptingInterface::runUnzip(QString path, QUrl url, bool autoAdd, bool · 14 unmodified lines
60 57
61 if (!fileList.isEmpty()) {58 if (!fileList.isEmpty()) {
62 qCDebug(scriptengine) << "File to upload: " + fileList.first();59 qCDebug(scriptengine) << "File to upload: " + fileList.first();
63 }60 } else {
64 else {
65 qCDebug(scriptengine) << "Unzip failed";61 qCDebug(scriptengine) << "Unzip failed";
66 }62 }
67 emit unzipResult(path, fileList, autoAdd, isZip);63
64 if (path.contains("vr.google.com/downloads")) {
65 isZip = true;
66 }
67 emit unzipResult(path, fileList, autoAdd, isZip, isBlocks);
68 68
69}69}
70 70
@@ -115,18 +115,6 @@ QString FileScriptingInterface::convertUrlToPath(QUrl url) { · 44 unmodified lines
115 return newUrl;115 return newUrl;
116}116}
117 117
118// handles a download from Blocks in the marketplace
119QString FileScriptingInterface::downloadBlocksZip(QUrl url) {
120 qCDebug(scriptengine) << "Made it to the download blocks! " << url.toString();
121
122 /*auto request = DependencyManager::get<ResourceManager>()->createResourceRequest(nullptr, url);
123 connect(request, &ResourceRequest::finished, this, [this, url] {
124 unzipFile(url, ""); // so intellisense isn't mad
125 });
126 request->send();*/
127 return url.toString();
128}
129
130// this function is not in use118// this function is not in use
131void FileScriptingInterface::downloadZip(QString path, const QString link) {119void FileScriptingInterface::downloadZip(QString path, const QString link) {
132 QUrl url = QUrl(link);120 QUrl url = QUrl(link);