Skip to content
Myr

strip win32 path prefixes from resolved absolute symlinks

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by chima · committed by chima · parent b4581b4 · Browse files · 1 file+13 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+13 added−5 removed

  • other:+13 added−5 removed

1 file+13 added−5 removed

modified:src/click/types.py+13 added-5 removed
843 unmodified lines
844 # path even if the path to the link is absolute.845 if os.path.islink(rv):846 rv = os.readlink(rv)847848 # Join dir_ with the resolved symlink. If the resolved849 # path is relative, this will make it relative to the850 # original containing directory. If it is absolute, this851 # has no effect.852 rv = os.path.join(dir_, rv)848 # absolute links849 if os.path.isabs(rv):850 # os.readlink prepends path prefixes to absolute links851 # in windows.852 # Here we strip prefix from the resolved path853 rv_drive, rv_path = os.path.splitdrive(rv)854 stripped_rv_drive = rv_drive.split(os.path.sep)[-1]855 rv = os.path.join(stripped_rv_drive, rv_path)856 else:857 # For relative symlinks we join dir_ to the resolved858 # symlink. This will make it relative to the original859 # containing directory.860 rv = os.path.join(dir_, rv)861862 try:863 st = os.stat(rv)864 except OSError:
205 unmodified lines