From 6d9e6d9ba307e77cbc43aea2eec22303d78c9c35 Mon Sep 17 00:00:00 2001 From: papasi Date: Fri, 14 Mar 2014 22:58:44 -0700 Subject: [PATCH] cannot create file in the default working directory in osx app bundle --- ggpo/common/settings.py | 3 ++- ggpo/common/util.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ggpo/common/settings.py b/ggpo/common/settings.py index d0b9b8c..ce481ed 100644 --- a/ggpo/common/settings.py +++ b/ggpo/common/settings.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- import pickle +import os.path from PyQt4.QtCore import QSettings @@ -25,7 +26,7 @@ class Settings: WINE_LOCATION = 'wineLocation' GEOIP2DB_LOCATION = 'geoip2dbLocation' - _settings = QSettings('ggpo.ini', QSettings.IniFormat) + _settings = QSettings(os.path.join(os.path.expanduser("~"), 'ggpo.ini'), QSettings.IniFormat) @staticmethod def setBoolean(key, val): diff --git a/ggpo/common/util.py b/ggpo/common/util.py index 08b1cfc..e488ccf 100644 --- a/ggpo/common/util.py +++ b/ggpo/common/util.py @@ -9,7 +9,7 @@ from PyQt4 import QtGui, QtCore from ggpo.common.settings import Settings from ggpo.common import copyright - +from os.path import expanduser def checkUpdate(): versionurl = 'https://raw.github.com/doctorguile/pyqtggpo/master/VERSION' @@ -131,7 +131,7 @@ def loggerInit(): _logger = logging.getLogger('GGPO') _logger.setLevel(logging.INFO) fh = logging.handlers.RotatingFileHandler( - 'ggpo.log', mode='a', maxBytes=100000, backupCount=4) + os.path.join(expanduser("~"), 'ggpo.log'), mode='a', maxBytes=100000, backupCount=4) if Settings.value(Settings.DEBUG_LOG): fh.setLevel(logging.INFO) else: