beet config (#552): show non-existent user path

This makes sure to print out the user's configuration path location even if no
user config file exists. (This makes "BEETSCONFIG=xxx beet config -p" behave
as expected, for instance.) It's a little hacky. Does the approach make sense
to you, @geigerzaehler?
This commit is contained in:
Adrian Sampson 2014-02-28 14:31:38 -08:00
parent f0c0b5c54b
commit 86bf8b65ba

View file

@ -1265,11 +1265,21 @@ def config_func(lib, opts, args):
# Print paths.
if opts.paths:
filenames = []
for source in config.sources:
if not opts.defaults and source.default:
continue
if source.filename:
print(source.filename)
filenames.append(source.filename)
# In case the user config file does not exist, prepend it to the
# list.
user_path = config.user_config_path()
if user_path not in filenames:
filenames.insert(0, user_path)
for filename in filenames:
print(filename)
# Open in editor.
elif opts.edit: