INNER CODE UNIT · Python
_copy_web_icon
ok-oldking/ok-script · ok/ui/web/app.py:184
def _copy_web_icon(config, static_dir):
"""Copy the configured application icon into the served web assets."""
configured = config.get("gui_icon")
if not configured or str(configured).startswith(":/"):
return None
source = Path(configured)
if not source.is_absolute():
from ok.util.file import get_path_relative_to_exe
source = Path(get_path_relative_to_exe(str(configured)))
if not source.is_file():
return None
static_dir.mkdir(parents=True, exist_ok=True)
suffix = source.suffix.lower() or ".ico"
destination = static_dir / f"app-icon{suffix}"
if source.resolve() != destination.resolve():
shutil.copy2(source, destination)