Expand environment variables in config file include directives

This commit is contained in:
Kovid Goyal 2018-05-09 09:35:50 +05:30
parent b9fa8dbe42
commit e07d216a11
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 4 additions and 2 deletions

View File

@ -48,7 +48,7 @@ def parse_line(line, type_map, special_handling, ans, all_keys, base_path_for_in
if special_handling(key, val, ans):
return
if key == 'include':
val = val.strip()
val = os.path.expandvars(os.path.expanduser(val.strip()))
if not os.path.isabs(val):
val = os.path.join(base_path_for_includes, val)
try:

View File

@ -2,7 +2,9 @@
# You can include secondary config files via the "include" directive.
# If you use a relative path for include, it is resolved with respect to the
# location of the current config file. For example:
# location of the current config file. Note that environment variables
# are expanded, so ${USER}.conf becomes name.conf if USER=name
# For example:
# include other.conf
# Fonts {{{