Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions src/appimagetool.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,17 +824,24 @@ main (int argc, char *argv[])

/* Check if AppStream upstream metadata is present in source AppDir */
if(! no_appstream){
char application_id[PATH_MAX];
sprintf (application_id, "%s", basename(desktop_file));
replacestr(application_id, ".desktop", ".appdata.xml");
gchar *appdata_path = g_build_filename(source, "/usr/share/metainfo/", application_id, NULL);
if (! g_file_test(appdata_path, G_FILE_TEST_IS_REGULAR)){
char appdata_id[PATH_MAX];
char metainfo_id[PATH_MAX];
sprintf (appdata_id, "%s", basename(desktop_file));
replacestr(appdata_id, ".desktop", ".appdata.xml");
sprintf (metainfo_id, "%s", basename(desktop_file));
replacestr(metainfo_id, ".desktop", ".metainfo.xml");
gchar *appdata_path = g_build_filename(source, "/usr/share/metainfo/", appdata_id, NULL);
gchar *metainfo_path = g_build_filename(source, "/usr/share/metainfo/", metainfo_id, NULL);
gboolean appdata_exist = g_file_test(appdata_path, G_FILE_TEST_IS_REGULAR);
gboolean metadata_exist = g_file_test(metainfo_path, G_FILE_TEST_IS_REGULAR);

if (! appdata_exist && ! metadata_exist){
Comment on lines +836 to +838
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable naming inconsistency: metadata_exist should be named metainfo_exist to match the pattern used for metainfo_id and metainfo_path. The current name could cause confusion since "metadata" is a generic term, while "metainfo" specifically refers to the .metainfo.xml file type being checked.

Suggested change
gboolean metadata_exist = g_file_test(metainfo_path, G_FILE_TEST_IS_REGULAR);
if (! appdata_exist && ! metadata_exist){
gboolean metainfo_exist = g_file_test(metainfo_path, G_FILE_TEST_IS_REGULAR);
if (! appdata_exist && ! metainfo_exist){

Copilot uses AI. Check for mistakes.
fprintf (stderr, "WARNING: AppStream upstream metadata is missing, please consider creating it\n");
fprintf (stderr, " in usr/share/metainfo/%s\n", application_id);
fprintf (stderr, " in usr/share/metainfo/%s\n", metainfo_id);
fprintf (stderr, " Please see https://www.freedesktop.org/software/appstream/docs/chap-Quickstart.html#sect-Quickstart-DesktopApps\n");
fprintf (stderr, " for more information or use the generator at http://output.jsbin.com/qoqukof.\n");
} else {
fprintf (stderr, "AppStream upstream metadata found in usr/share/metainfo/%s\n", application_id);
fprintf (stderr, "AppStream upstream metadata found in usr/share/metainfo/%s\n", (appdata_exist ? appdata_id : metainfo_id));
/* Use ximion's appstreamcli to make sure that desktop file and appdata match together */
if(g_find_program_in_path ("appstreamcli")) {
char *args[] = {
Expand All @@ -854,7 +861,7 @@ main (int argc, char *argv[])
char *args[] = {
"appstream-util",
"validate-relax",
appdata_path,
(appdata_exist ? appdata_path : metainfo_path),
NULL
};
g_print("Trying to validate AppStream information with the appstream-util tool\n");
Expand Down