0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-12-22 06:00:00 +00:00

Ensure path for link files exists (#1755)

Authored by: Zirro
This commit is contained in:
Zirro 2021-11-23 01:40:53 +05:30 committed by pukkandan
parent f7b558df4d
commit 0e6b018a10
No known key found for this signature in database
GPG key ID: 0F00D95A001F4698

View file

@ -2690,6 +2690,8 @@ def _write_link_file(link_type):
self.report_error('Cannot write internet shortcut file because the "webpage_url" field is missing in the media information')
return False
linkfn = replace_extension(self.prepare_filename(info_dict, 'link'), link_type, info_dict.get('ext'))
if not self._ensure_dir_exists(encodeFilename(linkfn)):
return False
if self.params.get('overwrites', True) and os.path.exists(encodeFilename(linkfn)):
self.to_screen(f'[info] Internet shortcut (.{link_type}) is already present')
return True