[python-win32] samefile() for win

Carl Karsten carl at personnelware.com
Wed Jan 9 20:35:22 CET 2008


Many of the methods on
http://docs.python.org/lib/module-os.path.html
don't work on win.  like samefile()

I found:

39 	def samefile(path1, path2):
40 	    return getLongPathName(path1) == getLongPathName(path2)
41 	
42 	def getLongPathName(path):
43 	    buf = ctypes.create_unicode_buffer(260)
44 	    GetLongPathName = ctypes.windll.kernel32.GetLongPathNameW
45 	    rv = GetLongPathName(path, buf, 260)
46 	    if rv == 0 or rv > 260:
47 	        return path
48 	    else:
49 	        return buf.value

https://develop.participatoryculture.org/trac/democracy/browser/trunk/tv/platform/windows-xul/platformutils.py#L39

Would it make sense to add code like this to the standard module?

Carl K


More information about the python-win32 mailing list