Hi Walt,

Yes, I think your way is better.

I was wondering why I suggested a temporary copy and rename.  I then
remembered that the last time I did something similar it was copying
configuration files between networked machines operating in a master/slave
hot-standby mode.  There you had to operate the copy in a very atomic way as
you never knew when the link or other machine might crash.

Regards,

On 10/02/07, Walt Bilofsky <[EMAIL PROTECTED]> wrote:
>
> Hi, Pinus -
>
> That should work.  The files are read-only.
>
> I'd modify it a bit - for a file in the default directory, delete the
> same-named file from the target directory if it exists, and flag the
> file for copying during nil events.  Then if only part gets copied
> before the program exits, it'll start over automatically next time it
> runs.  No need to use tmp names.
>
> I've got several other things that get done in pieces in the event
> loop, so this won't be anything new.
>
> Thanks.
>
> - Walt
>
> "Pinus Alba" <[EMAIL PROTECTED]> wrote:
>
> >Hi Walt,
> >
> >If I wanted to achieve that functionality I'd do something like.
> >
> >Initialise from files in target directory or default directory given
> >preference to default directory.
> >
> >Create target directory if it doesn't exist.
> >
> >for each file x in default directory
> >   copy x to x.tmp in target directory, moving one block every nil event
> >   rename x.tmp to x in target directory
> >   delete x from default directory
> >end for
> >
> >In your event loop have a if (copying) check to set a suitable time-out
> for
> >EvtGetEvent to generate lots of nil events.
> >
> >Regards,
> >
> >p.s. I'm assuming that your data files are read-only as far as your app
> is
> >concerned.  If they are read/write you'd have to have a dirty flag system
> >for each block.
> >
> >

-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to