mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
Use win32api.GetFullPathName(path) if it exists to implement abspath().
This commit is contained in:
parent
28e66d1c5e
commit
9787bea4cd
1 changed files with 7 additions and 3 deletions
|
@ -369,6 +369,10 @@ def normpath(path):
|
|||
|
||||
# Return an absolute path.
|
||||
def abspath(path):
|
||||
if not isabs(path):
|
||||
path = join(os.getcwd(), path)
|
||||
return normpath(path)
|
||||
try:
|
||||
import win32api
|
||||
return win32api.GetFullPathName(path)
|
||||
except ImportError:
|
||||
if not isabs(path):
|
||||
path = join(os.getcwd(), path)
|
||||
return normpath(path)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue