For #1617: Use Confit's built-in path resolution

Has the side effect of raising more reasonable errors when the type is wrong.
This commit is contained in:
Adrian Sampson 2015-10-07 15:36:31 -07:00
parent fe1fab9aee
commit 9f1c113476

View file

@ -33,14 +33,12 @@ class IncludeLazyConfig(confit.LazyConfig):
super(IncludeLazyConfig, self).read(user, defaults)
try:
included_filenames = self['include'].get(list)
for view in self['include'].all_contents():
filename = view.as_filename()
if os.path.isfile(filename):
self.set_file(filename)
except confit.NotFoundError:
included_filenames = []
for filename in included_filenames:
filename = os.path.join(self.config_dir(), filename)
if os.path.isfile(filename):
self.set_file(filename)
pass
config = IncludeLazyConfig('beets', __name__)