| 1686 | #endif |
| 1687 | |
| 1688 | QString getUniqueResourceName(const QString& filePath) |
| 1689 | { |
| 1690 | auto newFileName = filePath; |
| 1691 | if (!newFileName.endsWith(".disabled")) { |
| 1692 | return newFileName; // prioritize enabled mods |
| 1693 | } |
| 1694 | newFileName.chop(9); |
| 1695 | if (!QFile::exists(newFileName)) { |
| 1696 | return filePath; |
| 1697 | } |
| 1698 | QFileInfo fileInfo(filePath); |
| 1699 | auto baseName = fileInfo.completeBaseName(); |
| 1700 | auto path = fileInfo.absolutePath(); |
| 1701 | |
| 1702 | int counter = 1; |
| 1703 | do { |
| 1704 | if (counter == 1) { |
| 1705 | newFileName = FS::PathCombine(path, baseName + ".duplicate"); |
| 1706 | } else { |
| 1707 | newFileName = FS::PathCombine(path, baseName + ".duplicate" + QString::number(counter)); |
| 1708 | } |
| 1709 | counter++; |
| 1710 | } while (QFile::exists(newFileName)); |
| 1711 | |
| 1712 | return newFileName; |
| 1713 | } |
| 1714 | bool removeFiles(QStringList listFile) |
| 1715 | { |
| 1716 | bool ret = true; |
no test coverage detected