Fix log file location

This commit is contained in:
Jon Tibble 2010-06-22 13:32:15 +01:00
parent 70df49476d
commit a9e9f334e2
2 changed files with 16 additions and 1 deletions

View File

@ -163,7 +163,7 @@ def main():
parser.add_option("-s", "--style", dest="style",
help="Set the Qt4 style (passed directly to Qt4).")
# Set up logging
log_path = AppLocation.get_directory(AppLocation.ConfigDir)
log_path = AppLocation.get_directory(AppLocation.CacheDir)
if not os.path.exists(log_path):
os.makedirs(log_path)
filename = os.path.join(log_path, u'openlp.log')

View File

@ -50,6 +50,7 @@ class AppLocation(object):
DataDir = 3
PluginsDir = 4
VersionDir = 5
CacheDir = 6
@staticmethod
def get_directory(dir_type=1):
@ -103,6 +104,20 @@ class AppLocation(object):
else:
plugin_path = os.path.split(openlp.__file__)[0]
return plugin_path
elif dir_type == AppLocation.CacheDir:
if sys.platform == u'win32':
path = os.path.join(os.getenv(u'APPDATA'), u'openlp')
elif sys.platform == u'darwin':
path = os.path.join(os.getenv(u'HOME'), u'Library',
u'Application Support', u'openlp')
else:
try:
from xdg import BaseDirectory
path = os.path.join(
BaseDirectory.xdg_cache_home, u'openlp')
except ImportError:
path = os.path.join(os.getenv(u'HOME'), u'.openlp')
return path
@staticmethod
def get_data_path():