@@ -27,6 +27,7 @@ extern "C" {
2727#include < QRegularExpression>
2828#include < QSettings>
2929#include < QStandardPaths>
30+ #include < appimage/update.h>
3031
3132// local headers
3233#include " shared.h"
@@ -422,19 +423,23 @@ bool installDesktopFileAndIcons(const QString& pathToAppImage, bool resolveColli
422423#ifdef ENABLE_UPDATE_HELPER
423424 // add Update action
424425 {
425- const auto updateSectionName = " Desktop Action Update" ;
426-
427- g_key_file_set_string (desktopFile.get (), updateSectionName, " Name" , " Update AppImage" );
428-
429- std::ostringstream updateExecPath;
430- updateExecPath << CMAKE_INSTALL_PREFIX << " /" << CMAKE_INSTALL_LIBDIR << " /appimagelauncher/update " << pathToAppImage.toStdString ();
431- g_key_file_set_string (desktopFile.get (), updateSectionName, " Exec" , updateExecPath.str ().c_str ());
432-
433- // install translations
434- auto it = QMapIterator<QString, QString>(updateActionNameTranslations);
435- while (it.hasNext ()) {
436- auto entry = it.next ();
437- g_key_file_set_locale_string (desktopFile.get (), updateSectionName, " Name" , entry.key ().toStdString ().c_str (), entry.value ().toStdString ().c_str ());
426+ appimage::update::Updater updater (pathToAppImage.toStdString ());
427+ if (!updater.updateInformation ().empty ()) {
428+ const auto updateSectionName = " Desktop Action Update" ;
429+
430+ g_key_file_set_string (desktopFile.get (), updateSectionName, " Name" , " Update AppImage" );
431+
432+ std::ostringstream updateExecPath;
433+ updateExecPath << CMAKE_INSTALL_PREFIX << " /" << CMAKE_INSTALL_LIBDIR << " /appimagelauncher/update "
434+ << pathToAppImage.toStdString ();
435+ g_key_file_set_string (desktopFile.get (), updateSectionName, " Exec" , updateExecPath.str ().c_str ());
436+
437+ // install translations
438+ auto it = QMapIterator<QString, QString>(updateActionNameTranslations);
439+ while (it.hasNext ()) {
440+ auto entry = it.next ();
441+ g_key_file_set_locale_string (desktopFile.get (), updateSectionName, " Name" , entry.key ().toStdString ().c_str (), entry.value ().toStdString ().c_str ());
442+ }
438443 }
439444 }
440445#endif
0 commit comments