diff --git a/openlp.pyw b/openlp.pyw index 5ec730e22..fd8bfb41e 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -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') diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 78c16e26a..4fb1e613e 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -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():