Skip to content

Instantly share code, notes, and snippets.

@cofi89
Last active January 7, 2017 23:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cofi89/2a9931c9e3ec630366f6a68a5577ec59 to your computer and use it in GitHub Desktop.
Save cofi89/2a9931c9e3ec630366f6a68a5577ec59 to your computer and use it in GitHub Desktop.
Git-Cola "icons_dir" prototype ( absolute + ~/.config/git-cola/icons check )
def icon_dir(theme=None):
"""Return the path to the style dir within the cola install tree."""
if theme:
theme_final_dir = None
theme_absolute_dir = None
try:
theme_absolute_dir = os.path.expanduser(theme)
theme_final_dir = os.path.isdir(theme_absolute_dir)
except TypeError:
pass
if theme_final_dir:
return theme_final_dir
theme_home_dir = config_home('icons', theme)
theme_share_dir = share('icons', theme)
if os.path.isdir(theme_home_dir):
return theme_home_dir
elif os.path.isdir(theme_share_dir):
return theme_share_dir
else:
return share('icons')
else:
return share('icons')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment