Showing the changes to interface/src/Application.cpp (1 of 2 files). Show all
Unified · Split
| @@ -6328,20 +6328,19 @@ void Application::addAssetToWorldUnzipFailure(QString filePath) { · 6327 unmodified lines | ||
| 6328 | 6328 | addAssetToWorldError(filename, "Couldn't unzip file " + filename + "."); |
| 6329 | 6329 | } |
| 6330 | 6330 | |
| 6331 | −void Application::addAssetToWorld(QString filePath, QString zipFile, bool isZip, bool isBlocks) { | |
| 6331 | +void Application::addAssetToWorld(QString path, QString zipFile, bool isZip, bool isBlocks) { | |
| 6332 | 6332 | // Automatically upload and add asset to world as an alternative manual process initiated by showAssetServerWidget(). |
| 6333 | 6333 | QString mapping; |
| 6334 | − QString path = filePath; | |
| 6335 | 6334 | QString filename = filenameFromPath(path); |
| 6336 | − if (isZip) { | |
| 6337 | − QString assetFolder = zipFile.section("/", -1); | |
| 6338 | − assetFolder.remove(".zip"); | |
| 6339 | − mapping = "/" + assetFolder + "/" + filename; | |
| 6340 | − } else if (isBlocks) { | |
| 6341 | − qCDebug(interfaceapp) << "Path to asset folder: " << zipFile; | |
| 6342 | − QString assetFolder = zipFile.section('/', -1); | |
| 6343 | − assetFolder.remove(".zip?noDownload=false"); | |
| 6344 | − mapping = "/" + assetFolder + "/" + filename; | |
| 6335 | + if (isZip || isBlocks) { | |
| 6336 | + QString assetName; | |
| 6337 | + if (isZip) { | |
| 6338 | + assetName = zipFile.section("/", -1).remove(".zip"); | |
| 6339 | + } else if (isBlocks) { | |
| 6340 | + assetName = zipFile.section("/", -1).remove(".zip?noDownload=false"); | |
| 6341 | + } | |
| 6342 | + QString assetFolder = path.section("model_repo/", -1); | |
| 6343 | + mapping = "/" + assetName + "/" + assetFolder; | |
| 6345 | 6344 | } else { |
| 6346 | 6345 | mapping = "/" + filename; |
| 6347 | 6346 | } |
| @@ -6727,8 +6726,10 @@ void Application::handleUnzip(QString zipFile, QStringList unzipFile, bool autoA · 379 unmodified lines | ||
| 6727 | 6726 | if (autoAdd) { |
| 6728 | 6727 | if (!unzipFile.isEmpty()) { |
| 6729 | 6728 | for (int i = 0; i < unzipFile.length(); i++) { |
| 6730 | − qCDebug(interfaceapp) << "Preparing file for asset server: " << unzipFile.at(i); | |
| 6731 | − addAssetToWorld(unzipFile.at(i), zipFile, isZip, isBlocks); | |
| 6729 | + if (QFileInfo(unzipFile.at(i)).isFile()) { | |
| 6730 | + qCDebug(interfaceapp) << "Preparing file for asset server: " << unzipFile.at(i); | |
| 6731 | + addAssetToWorld(unzipFile.at(i), zipFile, isZip, isBlocks); | |
| 6732 | + } | |
| 6732 | 6733 | } |
| 6733 | 6734 | } else { |
| 6734 | 6735 | addAssetToWorldUnzipFailure(zipFile); |