//! Icons for `svg()`: the client's own Lucide SVGs //! (`crates/voelin-ui/ui/assets/icons`, Lucide 1.48, read from the checkout //! at run time) under `voelin/.svg`, then gpui-kit-assets' complete //! Lucide 1.43 catalog under `icons/.svg` (what gpui-component's //! `Icon` uses). use std::borrow::Cow; use std::path::PathBuf; use gpui_kit::{AssetSource, Result, SharedString}; /// The client's icons first, then gpui-kit's catalog. pub struct Assets { client_icons: PathBuf, } impl Default for Assets { fn default() -> Self { Self { client_icons: PathBuf::from(env!("CARGO_MANIFEST_DIR")) .join("../../../crates/voelin-ui/ui/assets/icons"), } } } impl AssetSource for Assets { fn load(&self, path: &str) -> Result>> { if let Some(name) = path.strip_prefix("voelin/") { return Ok(std::fs::read(self.client_icons.join(name)).ok().map(Cow::Owned)); } gpui_kit::assets::AllAssets.load(path) } fn list(&self, path: &str) -> Result> { gpui_kit::assets::AllAssets.list(path) } }