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

Function initialSearchForAppImages

src/daemon/main.cpp:60–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60void initialSearchForAppImages(const QDirSet& dirsToSearch, Worker& worker) {
61 // initial search for AppImages; if AppImages are found, they will be integrated, unless they already are
62 std::cout << "Searching for existing AppImages" << std::endl;
63
64 for (const auto& dir : dirsToSearch) {
65 std::cout << "Searching directory: " << dir.absolutePath().toStdString() << std::endl;
66
67 for (QDirIterator it(dir); it.hasNext();) {
68 const auto& path = it.next();
69
70 if (QFileInfo(path).isFile()) {
71 const auto appImageType = appimage_get_type(path.toStdString().c_str(), false);
72 const auto isAppImage = 0 < appImageType && appImageType <= 2;
73
74 if (isAppImage) {
75 // at application startup, we don't want to integrate AppImages that have been integrated already,
76 // as that it slows down very much
77 // the integration will be updated as soon as any of these AppImages is run with AppImageLauncher
78 std::cout << "Found AppImage: " << path.toStdString() << std::endl;
79
80 if (!appimage_is_registered_in_system(path.toStdString().c_str())) {
81 std::cout << "AppImage is not integrated yet, integrating" << std::endl;
82 worker.scheduleForIntegration(path);
83 } else if (!desktopFileHasBeenUpdatedSinceLastUpdate(path)) {
84 std::cout << "AppImage has been integrated already but needs to be reintegrated" << std::endl;
85 worker.scheduleForIntegration(path);
86 } else {
87 std::cout << "AppImage integrated already, skipping" << std::endl;
88 }
89 }
90 }
91 }
92 }
93}
94
95int main(int argc, char* argv[]) {
96 // make sure shared won't try to use the UI

Callers 1

mainFunction · 0.85

Tested by

no test coverage detected