forked from openlp/openlp
Fix log file location
This commit is contained in:
parent
70df49476d
commit
a9e9f334e2
@ -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')
|
||||
|
@ -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():
|
||||
|
Loading…
Reference in New Issue
Block a user