realbasic-nug
[Top] [All Lists]

Re: Safe File Saving

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Safe File Saving
From: Norman Palardy <npalardy at great-white-software dot com>
Date: Tue, 31 Jan 2006 18:17:54 -0800
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <20060201015506 dot 78056 dot qmail at web34606 dot mail dot mud dot yahoo dot com> <4317D102-4DA1-4654-8CAD-E6D6D17DBD7B at athenet dot net>

On Jan 31, 2006, at 6:02 PM, Adam Ernst wrote:

On Jan 31, 2006, at 7:55 PM, Tomis E. wrote:

Well naturally you can not replace an existing file.

Hmmm... why not?
Because the OS wont let you ?
It's in use.
You could easily crash the app if the OS let you swap out files that are in use.

So move the existing file somewhere else, or
rename the existing file. Then once you're sure the new file is in place, delete the old one.

I could do that. But I'd rather not, if I don't have to.
I know the REALbasic IDE does this kind of temp-file-overwriting. How do they handle it? Anyone?

On windows I'm not sure
On Carbon there is a SwapFiles call (I think it's even in the Carbon Declare Library) So you can write a temporary, then call SwapFiles and the OS does it in one shot. You can do some cool stuff with that as the processes using the files don't even know it has happened.

Renaming can be messy, so I'd suggest moving.
Perhaps. But then the user wouldn't know where to find it.
Rename it in place
Dont move it elsewhere

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>