| 539 | } |
| 540 | |
| 541 | bool updateDesktopDatabaseAndIconCaches() { |
| 542 | const auto dataLocation = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); |
| 543 | |
| 544 | const std::map<std::string, std::string> commands = { |
| 545 | {"update-desktop-database", dataLocation.toStdString() + "/applications"}, |
| 546 | {"gtk-update-icon-cache-3.0", dataLocation.toStdString() + "/icons/hicolor/ -t"}, |
| 547 | {"gtk-update-icon-cache", dataLocation.toStdString() + "/icons/hicolor/ -t"}, |
| 548 | {"xdg-desktop-menu", "forceupdate"}, |
| 549 | {"update-mime-database", dataLocation.toStdString() + "/mime "}, |
| 550 | {"update-icon-caches", dataLocation.toStdString() + "/icons/"}, |
| 551 | }; |
| 552 | |
| 553 | for (const auto& command : commands) { |
| 554 | // only call if the command exists |
| 555 | if (system(("which " + command.first + " 2>&1 1>/dev/null").c_str()) == 0) { |
| 556 | // exit codes are not evaluated intentionally |
| 557 | system((command.first + " " + command.second).c_str()); |
| 558 | } |
| 559 | } |
| 560 | |
| 561 | return true; |
| 562 | } |
| 563 | |
| 564 | std::shared_ptr<char> getOwnBinaryPath() { |
| 565 | auto path = std::shared_ptr<char>(realpath("/proc/self/exe", nullptr)); |
no outgoing calls
no test coverage detected