FIXME: ugly code duplication
| 185 | |
| 186 | // FIXME: ugly code duplication |
| 187 | QDir getAssetsDir(const QString &assetsId, const QString &resourcesFolder) |
| 188 | { |
| 189 | QDir assetsDir = QDir("assets/"); |
| 190 | QDir indexDir = QDir(FS::PathCombine(assetsDir.path(), "indexes")); |
| 191 | QDir objectDir = QDir(FS::PathCombine(assetsDir.path(), "objects")); |
| 192 | QDir virtualDir = QDir(FS::PathCombine(assetsDir.path(), "virtual")); |
| 193 | |
| 194 | QString indexPath = FS::PathCombine(indexDir.path(), assetsId + ".json"); |
| 195 | QFile indexFile(indexPath); |
| 196 | QDir virtualRoot(FS::PathCombine(virtualDir.path(), assetsId)); |
| 197 | |
| 198 | if (!indexFile.exists()) |
| 199 | { |
| 200 | qCritical() << "No assets index file" << indexPath << "; can't determine assets path!"; |
| 201 | return virtualRoot; |
| 202 | } |
| 203 | |
| 204 | AssetsIndex index; |
| 205 | if(!AssetsUtils::loadAssetsIndexJson(assetsId, indexPath, index)) |
| 206 | { |
| 207 | qCritical() << "Failed to load asset index file" << indexPath << "; can't determine assets path!"; |
| 208 | return virtualRoot; |
| 209 | } |
| 210 | |
| 211 | QString targetPath; |
| 212 | if(index.isVirtual) |
| 213 | { |
| 214 | return virtualRoot; |
| 215 | } |
| 216 | else if(index.mapToResources) |
| 217 | { |
| 218 | return QDir(resourcesFolder); |
| 219 | } |
| 220 | return virtualRoot; |
| 221 | } |
| 222 | |
| 223 | // FIXME: ugly code duplication |
| 224 | bool reconstructAssets(QString assetsId, QString resourcesFolder) |
no test coverage detected