summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Vogt <fvogt@suse.de>2022-02-15 13:25:46 +0100
committerRichard Hughes <richard@hughsie.com>2022-02-16 14:29:56 +0000
commit349799ba1d026a18012520b9f2e1901a88ac467b (patch)
tree68e7910a78a0e6204bfcd2eee76699069189973b
parent67a3b2e4fde085b88a7ba4028df968bfc864c76f (diff)
downloadappstream-glib-349799ba1d026a18012520b9f2e1901a88ac467b.tar.gz
libappstream-builder: Fix file paths in icon tarball
dbd62f6e05 removed the WxH directory from the icon filenames, which were also used as-is for the paths in the icons tarball. However, if width and height are set on the icon, then it has to be inside a size-specific directory. With HiDPI enabled, it did even overwrite the non-HiDPI icon it saved just before because the filenames were the same. Add the subdirectory back in the resource handling code.
-rw-r--r--libappstream-builder/asb-app.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libappstream-builder/asb-app.c b/libappstream-builder/asb-app.c
index b7a14dc..fdbc100 100644
--- a/libappstream-builder/asb-app.c
+++ b/libappstream-builder/asb-app.c
@@ -145,6 +145,7 @@ asb_app_save_resources (AsbApp *app, AsbAppSaveFlags save_flags, GError **error)
icons = as_app_get_icons (AS_APP (app));
for (i = 0; icons != NULL && i < icons->len; i++) {
const gchar *tmpdir;
+ g_autofree gchar *dir = NULL;
g_autofree gchar *filename = NULL;
g_autofree gchar *size_str = NULL;
g_autoptr(GError) error_local = NULL;
@@ -165,7 +166,9 @@ asb_app_save_resources (AsbApp *app, AsbAppSaveFlags save_flags, GError **error)
/* save to disk */
tmpdir = asb_package_get_config (priv->pkg, "IconsDir");
- filename = g_build_filename (tmpdir,
+ dir = g_strdup_printf ("%ix%i", as_icon_get_width (icon),
+ as_icon_get_height (icon));
+ filename = g_build_filename (tmpdir, dir,
as_icon_get_name (icon),
NULL);
if (!gdk_pixbuf_save (pixbuf, filename, "png", error, NULL))