hughsie / appstream-glib

This library provides objects and helper methods to help reading and writing AppStream metadata.
GNU Lesser General Public License v2.1
65 stars 103 forks source link

libappstream-builder: Fix file paths in icon tarball #430

Closed Vogtinator closed 2 years ago

Vogtinator commented 2 years ago

dbd62f6e05 (#390) 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.

CC @pwithnall

Before:

(appstream-builder:18724): Asb-DEBUG: 13:24:10.614: DEBUG:   Saved icon /tmp/tmp.wfYnMaboui/apb/icons/org.qbittorrent.qBittorrent.png
(appstream-builder:18724): Asb-DEBUG: 13:24:10.638: DEBUG:   Saved icon /tmp/tmp.wfYnMaboui/apb/icons/org.qbittorrent.qBittorrent.png
...
    <icon type="cached" height="64" width="64">org.qbittorrent.qBittorrent.png</icon>
    <icon type="cached" height="128" width="128">org.qbittorrent.qBittorrent.png</icon>
...
> tar tvf appdata-icons.tar.gz 
-rw-r--r-- 0/0            4983 1970-01-01 01:00 org.qbittorrent.qBittorrent.png

Now:

(appstream-builder:18837): Asb-DEBUG: 13:25:14.134: DEBUG:   Saved icon /tmp/tmp.wfYnMaboui/apb/icons/64x64/org.qbittorrent.qBittorrent.png
(appstream-builder:18837): Asb-DEBUG: 13:25:14.157: DEBUG:   Saved icon /tmp/tmp.wfYnMaboui/apb/icons/128x128/org.qbittorrent.qBittorrent.png
...
    <icon type="cached" height="64" width="64">org.qbittorrent.qBittorrent.png</icon>
    <icon type="cached" height="128" width="128">org.qbittorrent.qBittorrent.png</icon>
...
-rw-r--r-- 0/0            4983 1970-01-01 01:00 128x128/org.qbittorrent.qBittorrent.png
-rw-r--r-- 0/0            2957 1970-01-01 01:00 64x64/org.qbittorrent.qBittorrent.png