Skip to content

Commit

Permalink
Support file: protocol for profile icons
Browse files Browse the repository at this point in the history
  • Loading branch information
fran-f committed Nov 9, 2020
1 parent c306fdc commit 251cf89
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/terminal_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,10 @@ def _load_profile_icon(self, icon, guid):
# to the plugin's cache directory, and load it from there.
cache_dir = self.get_package_cache_path(True)
icon_file = guid + ".ico"
shutil.copyfile(os.path.expandvars(icon), cache_dir + "\\" + icon_file)
source = icon[8:] if icon[0:8] == "file:///" else os.path.expandvars(icon)
shutil.copyfile(source, cache_dir + "\\" + icon_file)
return self.load_icon("cache://Terminal-Profiles/" + icon_file)
except (ValueError, FileNotFoundError):
except (ValueError, FileNotFoundError, OSError):
self.warn("Cannot load icon '%s' for profile %s" % (icon, guid))

return None
Expand Down

0 comments on commit 251cf89

Please sign in to comment.