claude-proxy / src /free_claude_code /cli /desktop_assets.py
dheraingoud's picture
sync: upstream 9194f15 + custom addons (KeyRotator, RotatingChatTransport, sol/terra/luna, ScannerTrap, health, Py3.12 compat)
e99df76
Raw History Blame Contribute Delete
1.01 kB
from __future__ import annotations
"""Packaged visual assets owned by the FCC desktop shell."""
from importlib.resources import files
from pathlib import Path
_ICON_FILES = {
".icns": "app-icon.icns",
".ico": "app-icon.ico",
".png": "app-icon.png",
}
def app_icon_bytes(suffix: str) -> bytes:
"""Read the packaged app icon matching a native file suffix."""
normalized_suffix = suffix.lower()
try:
filename = _ICON_FILES[normalized_suffix]
except KeyError as exc:
supported = ", ".join(sorted(_ICON_FILES))
raise ValueError(
f"Unsupported app icon format {suffix!r}; expected one of: {supported}"
) from exc
return files("free_claude_code").joinpath("assets", filename).read_bytes()
def export_app_icon(destination: Path) -> None:
"""Copy the packaged native icon to an installer-owned destination."""
destination.parent.mkdir(parents=True, exist_ok=True)
destination.write_bytes(app_icon_bytes(destination.suffix))