MCPcopy Create free account
hub / github.com/TheAssassin/AppImageLauncher / updateDesktopDatabaseAndIconCaches

Function updateDesktopDatabaseAndIconCaches

src/shared/shared.cpp:541–562  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

539}
540
541bool 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
564std::shared_ptr<char> getOwnBinaryPath() {
565 auto path = std::shared_ptr<char>(realpath("/proc/self/exe", nullptr));

Callers 3

mainFunction · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected