From 6ba3b2d340edac717696571e7bb25718707552d8 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Thu, 30 Jan 2025 17:34:29 -0500 Subject: [PATCH] theme: Properly resolve directory and chevron icons from icon themes (#23984) This PR fixes an issue where we weren't properly resolving directory and chevron icons from icon themes the way we were for file icons. We need to interpret the icon paths as relative to the extension directory. Release Notes: - N/A --- crates/theme/src/registry.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/crates/theme/src/registry.rs b/crates/theme/src/registry.rs index 7b101c2329a7de039096976dfc1bfa2056a3cd29..b5e47b23bf410b4b9714e5baef310b15004c0794 100644 --- a/crates/theme/src/registry.rs +++ b/crates/theme/src/registry.rs @@ -255,6 +255,14 @@ impl ThemeRegistry { ) -> Result<()> { let icon_theme_family = read_icon_theme(icon_theme_path, fs).await?; + let resolve_icon_path = |path: SharedString| { + icons_root_dir + .join(path.as_ref()) + .to_string_lossy() + .to_string() + .into() + }; + let mut state = self.state.write(); for icon_theme in icon_theme_family.themes { let icon_theme = IconTheme { @@ -265,23 +273,21 @@ impl ThemeRegistry { AppearanceContent::Dark => Appearance::Dark, }, directory_icons: DirectoryIcons { - collapsed: icon_theme.directory_icons.collapsed, - expanded: icon_theme.directory_icons.expanded, + collapsed: icon_theme.directory_icons.collapsed.map(resolve_icon_path), + expanded: icon_theme.directory_icons.expanded.map(resolve_icon_path), }, chevron_icons: ChevronIcons { - collapsed: icon_theme.chevron_icons.collapsed, - expanded: icon_theme.chevron_icons.expanded, + collapsed: icon_theme.chevron_icons.collapsed.map(resolve_icon_path), + expanded: icon_theme.chevron_icons.expanded.map(resolve_icon_path), }, file_icons: icon_theme .file_icons .into_iter() .map(|(key, icon)| { - let path = icons_root_dir.join(icon.path.as_ref()); - ( key, IconDefinition { - path: path.to_string_lossy().to_string().into(), + path: resolve_icon_path(icon.path), }, ) })