| 275 | } |
| 276 | |
| 277 | bool World::install(const QString &to, const QString &name) |
| 278 | { |
| 279 | auto finalPath = FS::PathCombine(to, FS::DirNameFromString(m_actualName, to)); |
| 280 | if(!FS::ensureFolderPathExists(finalPath)) |
| 281 | { |
| 282 | return false; |
| 283 | } |
| 284 | bool ok = false; |
| 285 | if(m_containerFile.isFile()) |
| 286 | { |
| 287 | QuaZip zip(m_containerFile.absoluteFilePath()); |
| 288 | if (!zip.open(QuaZip::mdUnzip)) |
| 289 | { |
| 290 | return false; |
| 291 | } |
| 292 | ok = !MMCZip::extractSubDir(&zip, m_containerOffsetPath, finalPath); |
| 293 | } |
| 294 | else if(m_containerFile.isDir()) |
| 295 | { |
| 296 | QString from = m_containerFile.filePath(); |
| 297 | ok = FS::copy(from, finalPath)(); |
| 298 | } |
| 299 | |
| 300 | if(ok && !name.isEmpty() && m_actualName != name) |
| 301 | { |
| 302 | World newWorld(finalPath); |
| 303 | if(newWorld.isValid()) |
| 304 | { |
| 305 | newWorld.rename(name); |
| 306 | } |
| 307 | } |
| 308 | return ok; |
| 309 | } |
| 310 | |
| 311 | bool World::rename(const QString &newName) |
| 312 | { |
no test coverage detected