Allow for-light/dark-theme icon overrides to work for plugin icons placed by the user in the override dir

This commit is contained in:
Kovid Goyal 2023-09-15 11:06:10 +05:30
parent c552076d91
commit fe29b9a34d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -173,6 +173,11 @@ class IconResourceManager:
ans = os.path.join(self.override_icon_path, sq) ans = os.path.join(self.override_icon_path, sq)
elif len(parts) == 2: elif len(parts) == 2:
entries = self.override_items.get(parts[0], ()) entries = self.override_items.get(parts[0], ())
if not entries and self.override_icon_path and parts[0] not in self.override_items:
try:
self.override_items[parts[0]] = entries = frozenset(os.listdir(os.path.join(self.override_icon_path, parts[0])))
except OSError:
self.override_items[parts[0]] = entries = frozenset()
if entries: if entries:
sq, ext = os.path.splitext(parts[1]) sq, ext = os.path.splitext(parts[1])
sq = f'{sq}-for-{self.color_palette}-theme{ext}' sq = f'{sq}-for-{self.color_palette}-theme{ext}'