INNER CODE UNIT · Python
_fetch_icon_as_png_path
rio-labs/rio · rio/app.py:466
async def _fetch_icon_as_png_path(self) -> Path:
"""
Fetches the app's icon and returns the path to it, as PNG file. This
will take care of fetching it (if needed) and converting it to PNG.
If the icon file isn't local, it will be stored in a temporary
directory. Note that since the result isn't a context manager, the file
won't ever be deleted.
If fetching the icon fails, the error is logged and the default icon is
used.
"""
# If the icon is a local PNG file, use it directly
if (
isinstance(self._icon, assets.PathAsset)
and self._icon.path.suffix == ".png"
and self._icon.path.exists()
):