Mercurial > public > mercurial-scm > hg-stable
diff mercurial/windows.py @ 9238:40196d036a71
util: add realpath() for getting the 'true' path.
The function is implemented for Mac OS X using the F_GETPATH fcntl,
and a basic implementation for Windows is provided as well. On other
POSIX systems, vanilla os.path.realpath() is used.
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Sun, 26 Jul 2009 17:25:08 +0200 |
parents | 705278e70457 |
children | 61e30f257c15 |
line wrap: on
line diff
--- a/mercurial/windows.py Fri Jul 24 00:40:00 2009 +0200 +++ b/mercurial/windows.py Sun Jul 26 17:25:08 2009 +0200 @@ -126,6 +126,15 @@ def normpath(path): return pconvert(os.path.normpath(path)) +def realpath(path): + ''' + Returns the true, canonical file system path equivalent to the given + path. + ''' + # TODO: There may be a more clever way to do this that also handles other, + # less common file systems. + return os.path.normpath(os.path.normcase(os.path.realpath(path))) + def samestat(s1, s2): return False