[darcs-users] DeleteFile on Windows
Simon Marlow
marlowsd at gmail.com
Fri Oct 9 11:45:35 UTC 2009
On 09/10/2009 07:38, Salvatore Insalaco wrote:
> On Fri, Oct 9, 2009 at 1:21 AM, Jason Dagit<dagit at codersbase.com> wrote:
>> Now, I think we can introduce POSIX file semantics on win32. Just check out
>> the articles I found. Particularly the second one.
>
> I really like this stuff!
> I'm going to take a look to it tomorrow, maybe we can fix this
> bug-inducing behavior once and forever.
>
> Petr, If we manage to do it with win32 I think this is a much better
> solution than moving files around, as it is a very expensive operation
> in Windows when you do it between different partitions.
Yes, using FILE_SHARE_DELETE sounds like a good plan. Be careful though:
http://blogs.msdn.com/oldnewthing/archive/2004/06/07/150047.aspx
if you delete the file, even though the DeleteFile succeeds, it still
exists in the directory until the last HANDLE is closed. So an attempt
to create a file with the same name will still fail. If you are
deleting a file in order to create a new one with the same name, then
you better call MoveFile() before DeleteFile().
Cheers,
Simon
More information about the darcs-users
mailing list