[RFC] unlink() implementation
Earnie Boyd
earnie_boyd@yahoo.com
Fri Oct 10 21:45:00 GMT 2003
Corinna Vinschen wrote:
>
> So, I would like to ask you folks, what you think about the idea,
> to try to move the file into the recycle bin, if delete file fails.
> The whole implementation then looks like this, every step only tried
> if the step before failed:
>
A move equals a copy + delete is some cases. It still will cause pain,
especially if the file is open. A rename may be better but IIRC that's
also broken for an open file.
> Step 1 (Only on NT):
>
> Try CreateFile(FILE_FLAG_DELETE_ON_CLOSE)/CloseHandle();
>
> Step 2:
>
> Try DeleteFile();
>
> Step 3:
>
> Try SHFileOperation(FO_DELETE) // moves to Recycle Bin
>
> Step 4:
>
> Store in delqueue.
>
> Besides the examination, that we could drop step 1 on NT, what do
> people think about the idea, to try to move the file to the
> recycle bin if a DeleteFile failed? Note that I didn't actually
> *test* it, but I'd like to know, if I'm something missing which
> invalidates the idea. Any really bad caveat?
>
I don't think it buys you anything but some wasted cycles.
Earnie
More information about the Cygwin-developers
mailing list