Skip to content

Commit

Permalink
[compat] Introduce compat_realpath (refs #23991)
Browse files Browse the repository at this point in the history
  • Loading branch information
dstftw authored and pareronia committed Jun 22, 2020
1 parent ef6b421 commit c4a6798
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions youtube_dl/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2754,6 +2754,17 @@ def compat_expanduser(path):
compat_expanduser = os.path.expanduser


if compat_os_name == 'nt' and sys.version_info < (3, 8):
# os.path.realpath on Windows does not follow symbolic links
# prior to Python 3.8 (see https://bugs.python.org/issue9949)
def compat_realpath(path):
while os.path.islink(path):
path = os.path.abspath(os.readlink(path))
return path
else:
compat_realpath = os.path.realpath


if sys.version_info < (3, 0):
def compat_print(s):
from .utils import preferredencoding
Expand Down

0 comments on commit c4a6798

Please sign in to comment.