Once and for all, fix the silly version problem!

This commit is contained in:
Raoul Snyman 2010-04-11 00:24:22 +02:00
parent ed7328f5a0
commit f8e3021162
2 changed files with 10 additions and 10 deletions

View File

@ -78,9 +78,7 @@ class OpenLP(QtGui.QApplication):
Run the OpenLP application.
"""
#Load and store current Application Version
filepath = AppLocation.get_directory(AppLocation.AppDir)
if not hasattr(sys, u'frozen'):
filepath = os.path.join(filepath, u'openlp')
filepath = AppLocation.get_directory(AppLocation.VersionDir)
filepath = os.path.join(filepath, u'.version')
fversion = None
try:

View File

@ -43,9 +43,10 @@ class AppLocation(object):
ConfigDir = 2
DataDir = 3
PluginsDir = 4
VersionDir = 5
@staticmethod
def get_directory(dir_type):
def get_directory(dir_type=1):
"""
Return the appropriate directory according to the directory type.
@ -83,17 +84,18 @@ class AppLocation(object):
elif dir_type == AppLocation.PluginsDir:
plugin_path = None
app_path = os.path.abspath(os.path.split(sys.argv[0])[0])
if sys.platform == u'win32':
if hasattr(sys, u'frozen') and sys.frozen == 1:
plugin_path = os.path.join(app_path, u'plugins')
else:
plugin_path = os.path.join(app_path, u'openlp', u'plugins')
elif sys.platform == u'darwin':
if hasattr(sys, u'frozen') and sys.frozen == 1:
plugin_path = os.path.join(app_path, u'plugins')
else:
plugin_path = os.path.join(
os.path.split(openlp.__file__)[0], u'plugins')
return plugin_path
elif dir_type == AppLocation.VersionDir:
if hasattr(sys, u'frozen') and sys.frozen == 1:
plugin_path = os.path.abspath(os.path.split(sys.argv[0])[0])
else:
plugin_path = os.path.split(openlp.__file__)[0]
return plugin_path
def check_latest_version(config, current_version):