35 'common_parameters': [], |
37 'common_parameters': [], |
36 'create_parameters': [], |
38 'create_parameters': [], |
37 'prune_parameters': [], |
39 'prune_parameters': [], |
38 } |
40 } |
39 } |
41 } |
40 |
|
41 # |
|
42 # Locations |
|
43 # |
|
44 |
|
45 if platform.system()!='Darwin': |
|
46 import xdg |
|
47 cfgfile=os.path.join(xdg.XDG_CONFIG_HOME, borgend.appname, "config.yaml") |
|
48 logs_dir=os.path.join(xdg.XDG_DATA_HOME, borgend.appname, "logs") |
|
49 else: |
|
50 import rumps |
|
51 __base=rumps.application_support(borgend.appname) |
|
52 cfgfile=os.path.join(__base, "config.yaml") |
|
53 logs_dir=os.path.join(__base, "logs") |
|
54 |
42 |
55 # |
43 # |
56 # Type checking etc. |
44 # Type checking etc. |
57 # |
45 # |
58 |
46 |
154 else: |
142 else: |
155 out=cfg |
143 out=cfg |
156 |
144 |
157 return out |
145 return out |
158 |
146 |
159 if not (os.path.exists(cfgfile) and os.path.isfile(cfgfile)): |
147 if not (os.path.exists(locations.cfgfile) and os.path.isfile(locations.cfgfile)): |
160 raise SystemExit("Configuration file required: %s" % cfgfile) |
148 raise SystemExit("Configuration file required: %s" % locations.cfgfile) |
161 |
149 |
162 logger.info("Reading configuration %s missing" % cfgfile) |
150 logger.info("Reading configuration %s missing" % locations.cfgfile) |
163 |
151 |
164 with io.open(cfgfile, 'r') as file: |
152 with io.open(locations.cfgfile, 'r') as file: |
165 settings=expand_env(yaml.load(file), os.environ); |
153 settings=expand_env(yaml.load(file), os.environ); |
166 |
154 |
167 # |
155 # |
168 # Verify basic settings |
156 # Verify basic settings |
169 # |
157 # |