-
-
Save MorganRamsay/fcef50ce3059b310449302575989d3e8 to your computer and use it in GitHub Desktop.
Python 3.6.4: os.path.abspath (lines 537-554 in ntpath.py)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
else: # use native Windows method on Windows | |
def abspath(path): | |
"""Return the absolute version of a path.""" | |
if path: # Empty path must return current working directory. | |
path = os.fspath(path) | |
try: | |
path = _getfinalpathname(path).replace('\\\\?\\', '') | |
except OSError: | |
pass # Bad path - return unchanged. | |
elif isinstance(path, bytes): | |
path = os.getcwdb() | |
else: | |
path = os.getcwd() | |
return normpath(path) | |
# realpath is a no-op on systems without islink support | |
realpath = abspath |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment