diff -r 06fc14211ba9 -r 91421eeb4426 config.py --- a/config.py Sun Jan 21 14:34:35 2018 +0000 +++ b/config.py Sun Jan 21 14:56:56 2018 +0000 @@ -6,7 +6,6 @@ import yaml import io import os -import xdg import string import logging from functools import reduce @@ -37,6 +36,26 @@ } } +# +# Branding +# + +appname="borgend" +appname_stylised="Borgend" + +# +# Locations +# + +if False: + import xdg + cfgfile=os.path.join(xdg.XDG_CONFIG_HOME, appname, "config.yaml") + logs_location=os.path.join(xdg.XDG_DATA_HOME, appname, "logs") +else: + import rumps + __base=rumps.application_support(appname) + cfgfile=os.path.join(__base, "config.yaml") + logs_location=os.path.join(__base, "logs") # # Type checking etc. @@ -124,12 +143,10 @@ return out -cfgfile=os.path.join(xdg.XDG_CONFIG_HOME, "borgend", "config.yaml") +if not (os.path.exists(cfgfile) and os.path.isfile(cfgfile)): + raise SystemExit("Configuration file required: %s" % cfgfile) -logger.info("Reading configuration file %s" % cfgfile) - -if not (os.path.exists(cfgfile) and os.path.isfile(cfgfile)): - raise SystemExit('Configuration file required: {cfgfile}') +logger.info("Reading configuration %s missing" % cfgfile) with io.open(cfgfile, 'r') as file: settings=expand_env(yaml.load(file), os.environ);