Fix data directory paths

bzr-revno: 1293
This commit is contained in:
Jon Tibble 2011-02-11 18:34:59 +00:00
commit 2bcc01f35d

View File

@ -165,6 +165,8 @@ def _get_os_dir_path(dir_type):
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':
if dir_type == AppLocation.DataDir:
return os.path.join(os.getenv(u'APPDATA'), u'openlp', u'data')
return os.path.join(os.getenv(u'APPDATA'), u'openlp') 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:
@ -177,11 +179,13 @@ def _get_os_dir_path(dir_type):
if dir_type == AppLocation.ConfigDir: if dir_type == AppLocation.ConfigDir:
return os.path.join(BaseDirectory.xdg_config_home, u'openlp') return os.path.join(BaseDirectory.xdg_config_home, u'openlp')
elif dir_type == AppLocation.DataDir: elif dir_type == AppLocation.DataDir:
return os.path.join(BaseDirectory.xdg_data_home, u'openlp') return os.path.join(BaseDirectory.xdg_data_home, u'openlp',
u'data')
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: if dir_type == AppLocation.DataDir:
return os.path.join(os.getenv(u'HOME'), u'.openlp') return os.path.join(os.getenv(u'HOME'), u'openlp', u'data')
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):
""" """
@ -189,8 +193,7 @@ def _get_frozen_path(frozen_option, non_frozen_option):
""" """
if hasattr(sys, u'frozen') and sys.frozen == 1: if hasattr(sys, u'frozen') and sys.frozen == 1:
return frozen_option return frozen_option
else: return non_frozen_option
return non_frozen_option
def check_latest_version(current_version): def check_latest_version(current_version):
""" """