[gimp] app: let's also check the appstream in the legacy location as fallback.



commit eb9b936d236b7818a946905488fd3b7265d86b4a
Author: Jehan <jehan girinstud io>
Date:   Wed Feb 23 20:51:46 2022 +0100

    app: let's also check the appstream in the legacy location as fallback.
    
    For some reason, our flatpak is moving the appstream file elsewhere,
    after installation (since all our scripts explicitly install it under
    metainfo/).
    
    So in flatpak, it is in /app/share/appdata/ (i.e. $DATADIR/appdata/).
    
    This is not right and should not be done by the flatpak system, but
    let's still verify this other location as it is legacy so it would not
    be totally impossible that some distributions do something similar when
    packaging GIMP.
    
    See also: https://github.com/flatpak/flatpak/issues/4775

 app/dialogs/welcome-dialog.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
---
diff --git a/app/dialogs/welcome-dialog.c b/app/dialogs/welcome-dialog.c
index 9419e961fd..f0c85e8aef 100644
--- a/app/dialogs/welcome-dialog.c
+++ b/app/dialogs/welcome-dialog.c
@@ -92,6 +92,22 @@ welcome_dialog_create (Gimp *gimp)
   appdata_path = g_build_filename (DESKTOP_DATADIR, "metainfo",
                                    "org.gimp.GIMP.appdata.xml",
                                    NULL);
+  if (! g_file_test (appdata_path, G_FILE_TEST_IS_REGULAR))
+    {
+      /* This should not happen since we install explicitly this file in
+       * metainfo/, but flatpak at least is overriding our install and
+       * moving the file to appdata/ (which used to be the legacy
+       * location). Hopefully they are the only ones doing it, but just
+       * in case, let's make an alternative check in this other
+       * location.
+       */
+      g_printerr ("%s: AppStream file '%s' is not a regular file.\n",
+                  G_STRFUNC, appdata_path);
+      g_free (appdata_path);
+      appdata_path = g_build_filename (DESKTOP_DATADIR, "appdata",
+                                       "org.gimp.GIMP.appdata.xml",
+                                       NULL);
+    }
   if (g_file_test (appdata_path, G_FILE_TEST_IS_REGULAR))
     {
       AsRelease *release;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]