Corrected the way application data folder is retrieved on Windows XP and Vista.

Using LinRegistry on Windows

bzr-revno: 267
This commit is contained in:
Carsten Tinggaard 2009-01-05 12:33:15 +00:00
parent b8fe3369b6
commit b3fb6aa182
1 changed files with 7 additions and 4 deletions

View File

@ -27,8 +27,9 @@ class ConfigHelper(object):
@staticmethod @staticmethod
def get_data_path(): def get_data_path():
if os.name == 'nt': if os.name == 'nt':
default = os.path.join(os.path.expanduser(u'~'), # ask OS for path to application data, set on Windows XP and Vista
u'Application Data', u'.openlp', u'data') appdata = os.getenv('APPDATA')
default = os.path.join(appdata, u'.openlp', u'data')
else: else:
default = os.path.expanduser(u'~/.openlp/data') default = os.path.expanduser(u'~/.openlp/data')
@ -70,8 +71,10 @@ class ConfigHelper(object):
""" """
reg = None reg = None
if os.name == 'nt': if os.name == 'nt':
from winregistry import WinRegistry #from winregistry import WinRegistry
reg = WinRegistry(r'\Software\openlp') #reg = WinRegistry(r'\Software\openlp')
from linregistry import LinRegistry
reg = LinRegistry(os.path.join(os.getenv('APPDATA'), '.openlp'))
else: else:
from linregistry import LinRegistry from linregistry import LinRegistry
reg = LinRegistry(os.path.join(os.getenv('HOME'), '.openlp')) reg = LinRegistry(os.path.join(os.getenv('HOME'), '.openlp'))