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
3232 // nothing for now
3333 }
3434
35−void FileScriptingInterface::runUnzip(QString path, QUrl url, bool autoAdd, bool isZip) {
35+void FileScriptingInterface::runUnzip(QString path, QUrl url, bool autoAdd, bool isZip, bool isBlocks) {
3636 qCDebug(scriptengine) << "Url that was downloaded: " + url.toString();
37− /*if ((url.toString()).contains("vr.google.com/downloads")) {
38−
39− path = downloadBlocksZip(url);
40− }*/
4137 qCDebug(scriptengine) << "Path where download is saved: " + path;
4238 QString fileName = "/" + path.section("/", -1);
39+ qCDebug(scriptengine) << "Filename: " << fileName;
4340 QString tempDir = path;
4441 if (!isZip) {
4542 tempDir.remove(fileName);
@@ -60,11 +57,14 @@ void FileScriptingInterface::runUnzip(QString path, QUrl url, bool autoAdd, bool · 14 unmodified lines
6057
6158 if (!fileList.isEmpty()) {
6259 qCDebug(scriptengine) << "File to upload: " + fileList.first();
63− }
64− else {
60+ } else {
6561 qCDebug(scriptengine) << "Unzip failed";
6662 }
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);
6868
6969 }
7070
@@ -115,18 +115,6 @@ QString FileScriptingInterface::convertUrlToPath(QUrl url) { · 44 unmodified lines
115115 return newUrl;
116116 }
117117
118−// handles a download from Blocks in the marketplace
119−QString 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−
130118 // this function is not in use
131119 void FileScriptingInterface::downloadZip(QString path, const QString link) {
132120 QUrl url = QUrl(link);