Showing the changes to libraries/script-engine/src/FileScriptingInterface.cpp (1 of 4 files). Show all
Unified · Split
| @@ -32,14 +32,11 @@ FileScriptingInterface::FileScriptingInterface(QObject* parent) : QObject(parent · 31 unmodified lines | ||
| 32 | 32 | // nothing for now |
| 33 | 33 | } |
| 34 | 34 | |
| 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) { | |
| 36 | 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 | 37 | qCDebug(scriptengine) << "Path where download is saved: " + path; |
| 42 | 38 | QString fileName = "/" + path.section("/", -1); |
| 39 | + qCDebug(scriptengine) << "Filename: " << fileName; | |
| 43 | 40 | QString tempDir = path; |
| 44 | 41 | if (!isZip) { |
| 45 | 42 | tempDir.remove(fileName); |
| @@ -60,11 +57,14 @@ void FileScriptingInterface::runUnzip(QString path, QUrl url, bool autoAdd, bool · 14 unmodified lines | ||
| 60 | 57 | |
| 61 | 58 | if (!fileList.isEmpty()) { |
| 62 | 59 | qCDebug(scriptengine) << "File to upload: " + fileList.first(); |
| 63 | − } | |
| 64 | − else { | |
| 60 | + } else { | |
| 65 | 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 | 115 | return newUrl; |
| 116 | 116 | } |
| 117 | 117 | |
| 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 | − | |
| 130 | 118 | // this function is not in use |
| 131 | 119 | void FileScriptingInterface::downloadZip(QString path, const QString link) { |
| 132 | 120 | QUrl url = QUrl(link); |