samefile() on windows platform?

Ben Hutchings ben.hutchings at roundpoint.com
Thu Apr 26 15:53:26 EDT 2001


m.bless at gmx.de (Martin Bless) writes:

> os.path.samefile(...) isn't available on the windows platform. With
> DOS/windows a drive may be substituted with the consequence that
> "x:\test.tmp" and "c:\abc\test.tmp" may actually refer to the same
> file.
> 
> How can I find the truename of a filespec?
> Without opening the file, as the intent is to prevent overwriting ...

But you can open a file without overwriting it.

> DOS used to have an interrupt returning the full expanded "truename"
> of a file. Is there an equivalent function somewhere in the winapi? If
> so I wasn't able to find it yet. How is it done?

There are functions in the Win32 API that might help, such as
QueryDosDevice(), but none of them are currently wrapped by win32all
(as far as I can see).

-- 
Any opinions expressed are my own and not necessarily those of Roundpoint.



More information about the Python-list mailing list