if filePath matches .*\.~[0-9]+~, increment the backup number else append .~1~
| 530 | // if filePath matches .*\.~[0-9]+~, increment the backup number |
| 531 | // else append .~1~ |
| 532 | static QString |
| 533 | nextBackup(const QString & filePath) |
| 534 | { |
| 535 | QRegExp rx(QString::fromUtf8("\\.~(\\d+)~$")); |
| 536 | int pos = rx.lastIndexIn(filePath); |
| 537 | if (pos >= 0) { |
| 538 | int i = rx.cap(1).toInt(); |
| 539 | return filePath.left(pos) + QString::fromUtf8(".~%1~").arg(i+1); |
| 540 | } else { |
| 541 | return filePath + QString::fromUtf8(".~1~"); |
| 542 | } |
| 543 | } |
| 544 | |
| 545 | QString |
| 546 | Project::saveProjectInternal(const QString & path, |
no test coverage detected