| 35 | } |
| 36 | |
| 37 | void AutoTestShell::initializeNotifications() |
| 38 | { |
| 39 | // Guard against installing to a non-test location. |
| 40 | QVERIFY2(QStandardPaths::isTestModeEnabled(), |
| 41 | "AutoTestShell::initializeNotifications() may be called only after AutoTestShell::init()"); |
| 42 | |
| 43 | const QString destination = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) |
| 44 | + QLatin1String{"/knotifications6/"} + QCoreApplication::applicationName() + QLatin1String{".notifyrc"}; |
| 45 | |
| 46 | const auto destinationDirectory = destination.first(destination.lastIndexOf(QLatin1Char{'/'})); |
| 47 | QVERIFY(QDir().mkpath(destinationDirectory)); |
| 48 | |
| 49 | // Remove the destination first because QFile::copy() does not overwrite |
| 50 | // and would keep a possibly obsolete version of the file. |
| 51 | QFile::remove(destination); |
| 52 | |
| 53 | const auto source = QStringLiteral(KDEVELOP_APP_DIR "/kdevelop.notifyrc"); |
| 54 | QVERIFY(QFile::copy(source, destination)); |
| 55 | } |