Fix Windows AppLocation (Bug #706396)

This commit is contained in:
Jon Tibble 2011-01-23 00:27:29 +00:00
parent 7fc5bea107
commit 09aee63cd2

View File

@ -137,10 +137,7 @@ class AppLocation(object):
os.path.split(openlp.__file__)[0]) os.path.split(openlp.__file__)[0])
return os.path.join(app_path, u'i18n') return os.path.join(app_path, u'i18n')
else: else:
return _get_os_dir_path(u'openlp', return _get_os_dir_path(dir_type)
os.path.join(os.getenv(u'HOME'), u'Library',
u'Application Support', u'openlp'),
os.path.join(os.getenv(u'HOME'), u'.openlp'), dir_type)
@staticmethod @staticmethod
def get_data_path(): def get_data_path():
@ -163,16 +160,16 @@ class AppLocation(object):
os.makedirs(path) os.makedirs(path)
return path return path
def _get_os_dir_path(win_option, darwin_option, non_base_dir_option, def _get_os_dir_path(dir_type):
dir_type=1):
""" """
Return a path based on which OS and environment we are running in. Return a path based on which OS and environment we are running in.
""" """
if sys.platform == u'win32': if sys.platform == u'win32':
return os.path.join(os.getenv(u'APPDATA'), win_option) return os.path.join(os.getenv(u'APPDATA', u'openlp')
elif sys.platform == u'darwin': elif sys.platform == u'darwin':
if dir_type == AppLocation.DataDir: if dir_type == AppLocation.DataDir:
return os.path.join(darwin_option, u'Data') return os.path.join(os.getenv(u'HOME'), u'Library',
u'Application Support', u'openlp', u'Data')
return darwin_option return darwin_option
else: else:
if XDG_BASE_AVAILABLE: if XDG_BASE_AVAILABLE:
@ -183,7 +180,7 @@ def _get_os_dir_path(win_option, darwin_option, non_base_dir_option,
elif dir_type == AppLocation.CacheDir: elif dir_type == AppLocation.CacheDir:
return os.path.join(BaseDirectory.xdg_cache_home, u'openlp') return os.path.join(BaseDirectory.xdg_cache_home, u'openlp')
else: else:
return non_base_dir_option return os.path.join(os.getenv(u'HOME'), u'.openlp')
def _get_frozen_path(frozen_option, non_frozen_option): def _get_frozen_path(frozen_option, non_frozen_option):
""" """