mirror of
https://github.com/python/cpython.git
synced 2025-08-27 20:25:18 +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.
|
# Return an absolute path.
|
||||||
def abspath(path):
|
def abspath(path):
|
||||||
|
try:
|
||||||
|
import win32api
|
||||||
|
return win32api.GetFullPathName(path)
|
||||||
|
except ImportError:
|
||||||
if not isabs(path):
|
if not isabs(path):
|
||||||
path = join(os.getcwd(), path)
|
path = join(os.getcwd(), path)
|
||||||
return normpath(path)
|
return normpath(path)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue