From 3796c779304f35e6f923d8ceffc7bdf60e7d3a14 Mon Sep 17 00:00:00 2001 From: Soumyadeep Ghosh Date: Mon, 27 Jul 2026 12:47:03 +0530 Subject: [PATCH] fix(desktop-file): verify theme icons before rewriting icon Theme-resolved icon path was written to the desktop file without checking the file exists, and the subsequent existence check ran against the bare icon name stored in `icon` variable, emitting a spurious "not found" warning. Assign the resolved path to the local var first so the same check covers theme icons. Signed-off-by: Soumyadeep Ghosh --- snapcraft/parts/desktop_file.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snapcraft/parts/desktop_file.py b/snapcraft/parts/desktop_file.py index 42e1345452..f4fbeffb2a 100644 --- a/snapcraft/parts/desktop_file.py +++ b/snapcraft/parts/desktop_file.py @@ -98,11 +98,11 @@ def _parse_and_reformat_section( # If icon is just a name (no path separator), try to resolve it from the hicolor icon theme. if "/" not in icon: if ( - icon_path := get_icon_from_theme( + theme_icon_path := get_icon_from_theme( os.fspath(self._prime_dir), "hicolor", icon ) ) is not None: - self._parser[section]["Icon"] = os.path.join("${SNAP}", icon_path) + icon = theme_icon_path # With everything stripped, check to see if the icon is there. # if it is, add "${SNAP}" back and set the icon