Skip to content

Commit

Permalink
OS X: Use standard locations for GPODDER_HOME. Fixes bug 1912
Browse files Browse the repository at this point in the history
If ~/gPodder/ does not exist, use ~/Library/Application Support/gPodder/
  • Loading branch information
thp committed May 9, 2014
1 parent 7cfd31e commit c18b48c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/gpodder/__init__.py
Expand Up @@ -166,8 +166,23 @@ def set_home(new_home):
if ENV_DOWNLOADS not in os.environ:
downloads = os.path.join(home, 'Downloads')

def fixup_home(old_home):
if ui.osx:
new_home = os.path.expanduser(os.path.join('~', 'Library',
'Application Support', 'gPodder'))

# Users who do not have the old home directory, or who have it but also
# have the new home directory (to cater to situations where the user
# might for some reason or the other have a ~/gPodder/ directory) get
# to use the new, more OS X-ish home.
if not os.path.exists(old_home) or os.path.exists(new_home):
return new_home

return old_home

# Default locations for configuration and data files
default_home = os.path.expanduser(os.path.join('~', 'gPodder'))
default_home = fixup_home(default_home)
set_home(os.environ.get(ENV_HOME, default_home))

if home != default_home:
Expand Down

0 comments on commit c18b48c

Please sign in to comment.