Skip to content

Commit

Permalink
Merge branch 'main' into add-logging
Browse files Browse the repository at this point in the history
  • Loading branch information
wtbarnes authored Oct 2, 2024
2 parents 0db96f1 + 39765a5 commit e55a5eb
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions hissw/read_config.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
"""
Read some default options if possible
"""

import pathlib
import configparser
import os

HISSW_DIR = pathlib.Path.home() / '.hissw'
HISSW_RC = HISSW_DIR / 'hisswrc'


defaults = {}
defaults['hissw_home'] = os.path.join(os.environ['HOME'], '.hissw')
if os.path.isfile(os.path.join(os.environ['HOME'], '.hissw', 'hisswrc')):
defaults['hissw_home'] = HISSW_DIR
if HISSW_RC.is_file():
config = configparser.ConfigParser()
config.read(os.path.join(os.environ['HOME'], '.hissw', 'hisswrc'))
config.read(HISSW_RC)
for key in config['hissw']:
defaults[key] = config['hissw'][key]
else:
Expand Down

0 comments on commit e55a5eb

Please sign in to comment.