| 317 | } |
| 318 | |
| 319 | bool World::install(const QString &to, const QString &name) |
| 320 | { |
| 321 | auto finalPath = FS::PathCombine(to, FS::DirNameFromString(m_actualName, to)); |
| 322 | if(!FS::ensureFolderPathExists(finalPath)) |
| 323 | { |
| 324 | return false; |
| 325 | } |
| 326 | bool ok = false; |
| 327 | if(m_containerFile.isFile()) |
| 328 | { |
| 329 | QuaZip zip(m_containerFile.absoluteFilePath()); |
| 330 | if (!zip.open(QuaZip::mdUnzip)) |
| 331 | { |
| 332 | return false; |
| 333 | } |
| 334 | ok = !MMCZip::extractSubDir(&zip, m_containerOffsetPath, finalPath); |
| 335 | } |
| 336 | else if(m_containerFile.isDir()) |
| 337 | { |
| 338 | QString from = m_containerFile.filePath(); |
| 339 | ok = FS::copy(from, finalPath)(); |
| 340 | } |
| 341 | |
| 342 | if(ok && !name.isEmpty() && m_actualName != name) |
| 343 | { |
| 344 | QFileInfo finalPathInfo(finalPath); |
| 345 | World newWorld(finalPathInfo); |
| 346 | if(newWorld.isValid()) |
| 347 | { |
| 348 | newWorld.rename(name); |
| 349 | } |
| 350 | } |
| 351 | return ok; |
| 352 | } |
| 353 | |
| 354 | bool World::rename(const QString &newName) |
| 355 | { |
no test coverage detected