From 856aec65de4b972253b0ca63bca01d35950ba5dc Mon Sep 17 00:00:00 2001 From: claudi Date: Tue, 10 Mar 2026 13:17:35 +0100 Subject: [PATCH] feat: ensure toolbar icons are included in MSI bundle during build process --- build/scripts/build_windows.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/build/scripts/build_windows.py b/build/scripts/build_windows.py index 67b960e..42d68fa 100644 --- a/build/scripts/build_windows.py +++ b/build/scripts/build_windows.py @@ -243,6 +243,10 @@ class WindowsBuilder: if not self._create_wix_source(): return False + # Ensure toolbar icons are present in bundled resources before harvesting. + if not self._ensure_toolbar_icons_in_bundle(): + return False + # Harvest application files using Heat print(f" Harvesting application files...") dist_folder = self.dist_dir / "WebDropBridge" @@ -352,6 +356,36 @@ class WindowsBuilder: return True + def _ensure_toolbar_icons_in_bundle(self) -> bool: + """Ensure toolbar icon files exist in the bundled app folder. + + This guarantees WiX Heat harvest includes these icons in the MSI, + even if a previous PyInstaller run omitted them. + """ + src_icons_dir = self.project_root / "resources" / "icons" + bundle_icons_dir = self.dist_dir / "WebDropBridge" / "_internal" / "resources" / "icons" + required_icons = ["home.ico", "reload.ico", "open.ico", "openwith.ico"] + + try: + bundle_icons_dir.mkdir(parents=True, exist_ok=True) + + for icon_name in required_icons: + src = src_icons_dir / icon_name + dst = bundle_icons_dir / icon_name + + if not src.exists(): + print(f"❌ Required icon not found: {src}") + return False + + if not dst.exists() or src.stat().st_mtime > dst.stat().st_mtime: + shutil.copy2(src, dst) + print(f" ✓ Ensured toolbar icon in bundle: {icon_name}") + + return True + except Exception as e: + print(f"❌ Failed to ensure toolbar icons in bundle: {e}") + return False + def _create_wix_source(self) -> bool: """Create WiX source file for MSI generation.