mirror of
https://github.com/yt-dlp/yt-dlp
synced 2024-12-26 21:59:08 +01:00
Make nested --config-locations relative to parent file
* and allow environment variables in it so that you can use `$PWD`/`%cd%` to specify paths relative to current directory
This commit is contained in:
parent
5e51f4a8ad
commit
65662dffb1
1 changed files with 3 additions and 1 deletions
|
@ -5222,8 +5222,10 @@ class Config:
|
|||
|
||||
def init(self, args=None, filename=None):
|
||||
assert not self.__initialized
|
||||
directory = ''
|
||||
if filename:
|
||||
location = os.path.realpath(filename)
|
||||
directory = os.path.dirname(location)
|
||||
if location in self._loaded_paths:
|
||||
return False
|
||||
self._loaded_paths.add(location)
|
||||
|
@ -5231,7 +5233,7 @@ class Config:
|
|||
self.__initialized = True
|
||||
self.own_args, self.filename = args, filename
|
||||
for location in self._parser.parse_args(args)[0].config_locations or []:
|
||||
location = compat_expanduser(location)
|
||||
location = os.path.join(directory, expand_path(location))
|
||||
if os.path.isdir(location):
|
||||
location = os.path.join(location, 'yt-dlp.conf')
|
||||
if not os.path.exists(location):
|
||||
|
|
Loading…
Reference in a new issue