This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] unlink() implementation


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]