Dylan Paul Thurston writes:
> On Thu, Jun 22, 2000 at 01:40:30AM -0700, Dave Peticolas wrote:
> > > Probably the temporary files should be in /tmp or /usr/tmp and contain
> > > the process number.
> >
> > If we put them in /tmp, then we really need to use something like
> > mkstemp(char *template) to get a unique name. But I'm not sure we
> > should put them there. First, if there is an error moving them, it's
> > easier to find them if we use the same directory (after all, they
> > should still have good data). Also, I was hoping to use the 'rename'
> > system call to make things simple (and usually atomic), but rename
> > doesn't work across different filesystems.
>
> OK, good points. What happens in the case when the file is writeable
> but the directory is not? What if the names you want to use are
> already taken, and the files are not writeable? (Example case: the
> distribution of gnucash comes with sample files, and a user wants to
> be able to try gnucash on these files without copying them to another
> directory.)
>
> It might be good to keep files in the same directory as much as
> possible, picking another name if necessary. I think Emacs handles
> all these cases pretty well; it might be worth looking at how it does
> it. (But it might also be worth implementing _something_ first.)
I looked around the Emacs (rather XEmacs, but it's probably very
similar) source and they save files pretty much in the same way,
i.e., they save to a temporary file in the same directory, and
then rename it. If they can't create a new file in the directory,
and the file doesn't have a 'precious' flag set, then they just
write over the existing file. I think we can assume that any
GnuCash data file is 'precious', so I think we should just
require the directory to be writable, rather than resort to
that.
dave
--
Gnucash Developer's List
To unsubscribe send empty email to: [EMAIL PROTECTED]