changeset 4:01015b36290a

look for home configuration file if it exists
author k0s <k0scist@gmail.com>
date Sat, 21 Nov 2009 19:52:10 -0500
parents c5f19f51e1e8
children 7328744920de
files setup.py smartopen/smartopen.py
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/setup.py	Sat Nov 21 17:50:38 2009 -0500
+++ b/setup.py	Sat Nov 21 19:52:10 2009 -0500
@@ -1,7 +1,7 @@
 from setuptools import setup, find_packages
 import sys, os
 
-version = '0.1'
+version = '0.1.1'
 
 setup(name='smartopen',
       version=version,
--- a/smartopen/smartopen.py	Sat Nov 21 17:50:38 2009 -0500
+++ b/smartopen/smartopen.py	Sat Nov 21 19:52:10 2009 -0500
@@ -89,7 +89,9 @@
 
     # config
     config = ConfigParser()
-    if options.config and os.path.exists(options.config):
+    if not options.config:
+        options.config = os.path.join(os.environ.get('HOME', ''), '.smartopen.ini')
+    if os.path.exists(options.config):
         config.read(options.config)
         if not options.handlers and config.has_option('DEFAULTS', 'handlers'):
             options.handlers = [ i.strip() for i in config.get('DEFAULTS', 'handlers').split(',') ]