* @brief Removes a shortcut on disk. macOS .app bundles are removed recursively. */
| 272 | * @brief Removes a shortcut on disk. macOS .app bundles are removed recursively. |
| 273 | */ |
| 274 | void Misc::ShortcutGenerator::deleteShortcut(const QString& shortcutPath) |
| 275 | { |
| 276 | const QString resolved = |
| 277 | QUrl(shortcutPath).isLocalFile() ? QUrl(shortcutPath).toLocalFile() : shortcutPath; |
| 278 | if (resolved.isEmpty()) |
| 279 | return; |
| 280 | |
| 281 | QFileInfo info(resolved); |
| 282 | if (!info.exists()) |
| 283 | return; |
| 284 | |
| 285 | if (info.isDir()) |
| 286 | QDir(resolved).removeRecursively(); |
| 287 | else |
| 288 | QFile::remove(resolved); |
| 289 | } |
| 290 | |
| 291 | //-------------------------------------------------------------------------------------------------- |
| 292 | // File-write dispatcher |
no test coverage detected