feat: ensure toolbar icons are included in MSI bundle during build process
Some checks are pending
Tests & Quality Checks / Test on Python 3.11 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.10 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-2 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-2 (push) Waiting to run
Tests & Quality Checks / Build Artifacts (push) Blocked by required conditions
Tests & Quality Checks / Build Artifacts-1 (push) Blocked by required conditions

This commit is contained in:
claudi 2026-03-10 13:17:35 +01:00
parent a261de3460
commit 856aec65de

View file

@ -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.