Merge pull request #181 from ckruse/master

fix: place config file under ~/.config/bungloo with backwards compatiblity (copies file to correct place and removes old directory)
This commit is contained in:
Jeena Paradies 2013-02-26 14:37:01 -08:00
commit 8c509ad6b5

View file

@ -4,6 +4,8 @@ import os, sys, pickle, subprocess
from PyQt4 import QtCore, QtGui, QtWebKit
import Windows, Helper
import shutil
class Bungloo:
def __init__(self):
@ -64,10 +66,16 @@ class Controller(QtCore.QObject):
QtCore.QObject.__init__(self)
self.app = app
if not os.path.exists(os.path.expanduser("~/.bungloo/")):
os.makedirs(os.path.expanduser("~/.bungloo/"))
oldpath = os.path.expanduser('~/.bungloo/')
if os.path.isdir(oldpath):
shutil.copytree(oldpath, os.path.expanduser('~/.config/bungloo/'))
shutil.rmtree(os.path.expanduser('~/.bungloo/'))
if not os.path.exists(os.path.expanduser("~/.config/bungloo/")):
os.makedirs(os.path.expanduser("~/.config/bungloo/"))
self.config_path = os.path.expanduser('~/.config/bungloo/bungloo.cfg')
self.config_path = os.path.expanduser('~/.bungloo/bungloo.cfg')
if os.access(self.config_path, os.R_OK):
with open(self.config_path, 'r') as f:
self.config = pickle.load(f)