History

Started blocks download catch, fixed a debug typo

Elisa Lupin-Jimenez committed 9 years ago

Commit d5997531 parent efd25a54 files · +35 −15Browse 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+19−3
@@ -34,6 +34,10 @@ FileScriptingInterface::FileScriptingInterface(QObject* parent) : QObject(parent · 33 unmodified lines
3434
3535 void FileScriptingInterface::runUnzip(QString path, QUrl url, bool autoAdd, bool isZip) {
3636 qCDebug(scriptengine) << "Url that was downloaded: " + url.toString();
37+ if ((url.toString()).contains("vr.google.com/downloads")) {
38+
39+ path = downloadBlocksZip(url);
40+ }
3741 qCDebug(scriptengine) << "Path where download is saved: " + path;
3842 QString fileName = "/" + path.section("/", -1);
3943 QString tempDir = path;
@@ -52,10 +56,10 @@ void FileScriptingInterface::runUnzip(QString path, QUrl url, bool autoAdd, bool · 12 unmodified lines
5256 }
5357
5458 QStringList fileList = unzipFile(path, tempDir);
55− QString filename = QUrl::fromLocalFile(fileList.first()).toString();
59+ //QString filename = QUrl::fromLocalFile(fileList.first()).toString();
5660
57− if (filename != "") {
58− qCDebug(scriptengine) << "File to upload: " + filename;
61+ if (!fileList.isEmpty()) {
62+ qCDebug(scriptengine) << "File to upload: " + fileList.first();
5963 }
6064 else {
6165 qCDebug(scriptengine) << "Unzip failed";
@@ -111,6 +115,18 @@ QString FileScriptingInterface::convertUrlToPath(QUrl url) { · 49 unmodified lines
111115 return newUrl;
112116 }
113117
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+
114130 // this function is not in use
115131 void FileScriptingInterface::downloadZip(QString path, const QString link) {
116132 QUrl url = QUrl(link);