summaryrefslogtreecommitdiff
path: root/src/config.py
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-01-31 05:33:54 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-01-31 05:33:54 +0000
commit9faeb0674c012383a2d01a9c17d97f94cc5a5897 (patch)
treee771a9985aca4a461f01f2af684ff8c44b1a3223 /src/config.py
parent6f34406477714668898e7a711e96268e2549d6c0 (diff)
downloadpoezio-9faeb0674c012383a2d01a9c17d97f94cc5a5897.tar.gz
poezio-9faeb0674c012383a2d01a9c17d97f94cc5a5897.tar.bz2
poezio-9faeb0674c012383a2d01a9c17d97f94cc5a5897.tar.xz
poezio-9faeb0674c012383a2d01a9c17d97f94cc5a5897.zip
cleanup, launch.sh, makefile
Diffstat (limited to 'src/config.py')
-rw-r--r--src/config.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/config.py b/src/config.py
index 302716f6..4a507522 100644
--- a/src/config.py
+++ b/src/config.py
@@ -19,7 +19,8 @@
# along with Poezio. If not, see <http://www.gnu.org/licenses/>.
from ConfigParser import RawConfigParser, NoOptionError
-# from logging import logger
+from os import environ, makedirs
+from shutil import copy2
class Config(RawConfigParser):
"""
@@ -78,4 +79,15 @@ class Config(RawConfigParser):
self.set(option, value)
self.save()
-config = Config('poezio.cfg')
+CONFIG_HOME = environ.get("XDG_CONFIG_HOME")
+if not CONFIG_HOME:
+ CONFIG_HOME = environ.get('HOME')+'/.config/'
+CONFIG_PATH = CONFIG_HOME + 'poezio/'
+
+try:
+ makedirs(CONFIG_PATH)
+ copy2('../data/default_config.cfg', CONFIG_PATH+'poezio.cfg')
+except:
+ pass
+
+config = Config(CONFIG_PATH+'poezio.cfg')