[issue5985] Implement os.path.samefile and os.path.sameopenfile on Windows
report at bugs.python.org
Sun May 10 12:02:48 CEST 2009
New submission from Erik Sandberg <sandberg at virtutech.com>:
It would be nice if samefile / sameopenfile was present on Windows.
Right now I usually work around this by keeping a platform-specific hack
for Windows that approximates samefile by comparing normalized paths;
this is ugly and doesn't handle junctions correctly.
In one of my projects I have written a C implementation of samefile,
which I manually monkey-patched os.path with. It would probably be
rather easy to adapt it to become a native part of ntpath.
My code relies on GetFileInformationByHandle, which is only available in
Windows 2000 professional and newer
(http://msdn.microsoft.com/en-us/library/aa364952(VS.85).aspx); if I
understood it correctly this should not be a problem as Python 2.6 and
newer doesn't support older versions of Windows.
Unfortunately I don't use Windows myself, but I have rdesktop access to
an XP machine with cygwin and Visual Studio 2005 installed (which seems
insufficient to build python 2.6, at least), so it will be difficult for
me to test my code. But I'll post some code soon.
title: Implement os.path.samefile and os.path.sameopenfile on Windows
type: feature request
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.0, Python 3.1, Python 3.2
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list