[Box Backup-dev] changeset [819]

Chris Wilson boxbackup-dev at fluffy.co.uk
Fri Sep 1 00:22:55 BST 2006


Hi Martin,

On Thu, 31 Aug 2006, Martin Ebourne wrote:

> On Thu, 2006-08-31 at 20:51 +0100, Chris Wilson wrote:
>> There is a possible clean solution, which is to use the Windows flag
>> FILE_FLAG_DELETE_ON_CLOSE when opening the file. To avoid the #ifdef, I
>> think I would have to invent a new flag to pass to the FileStream
>> constructor, which does nothing (define to zero) on other platforms, but
>> activates this Windows flag in openfile() on Win32.
>>
>> Does this seem like a sensible solution? And what should that flag be
>> called? O_DELETE_ON_CLOSE_WIN32?
>
> How about FileStream handling this platform specific stuff. All you need
> to do is tell FileStream when you construct it (use an overloaded
> constructor or give an extra bool parameter to the constructor) that you
> want the file automatically deleted.

Seems like a good idea, much cleaner. Will implement tomorrow.

> On windows it would then pass FILE_FLAG_DELETE_ON_CLOSE and on unix it
> would unlink it after opening it.

FileStream calls ::openfile (from lib/win32/emu.cpp) to open the file, so 
I would have to pass a new flag anyway, or a new parameter, to make this 
happen. Alternatibely, FileStream could delete the file itself in the 
Close method.

> Does that cover all possibilities? If so it would certainly tidy up a 
> lot of code around the place that is closing and deleting files.

I'm not certain that it covers them all, particularly renaming over open 
files, but I'm sure it would help.

Cheers, Chris.
-- 
_ ___ __     _
  / __/ / ,__(_)_  | Chris Wilson <0000 at qwirx.com> - Cambs UK |
/ (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer |
\ _/_/_/_//_/___/ | We are GNU-free your mind-and your software |




More information about the Boxbackup-dev mailing list