On Sunday 12 February 2006 4:47 pm, Derek Atkins wrote: > > I know how that happens - gnucash tries to identify the file by letting > > each backend try to open it in turn. If none can open it, it complains > > that it cannot understand which type of file it is meant to be. We can't > > use mimetypes to distinguish the forms (as two are text/xml and we've > > never enforced a mime-type on old files) so we do have to open the file > > to determine the type. > > Well, the other option is to actually pass the error up the stack > so that the caller can get a GNC_BACKEND_ERR_FILE_INACCESSIBLE (or > something like that) up the stack..
But when trying to determine the type, all we know is if it is the correct
type or not. In QSF, I'm implementing :
f=fopen(path, "r");
if(!f){ qof_backend_set_error(...);}
fclose(f);
block that sets a new QofBackendError: ERR_FILEIO_READ_ERROR at the start of
the file type check which I can also implement in gnucash. So at least then,
if we can't open the file for reading, we can set a backend error and quit
the load.
I'm still sorting out recursive copies. I've got G2 to produce a 1.1Mb QSF
XML file containing all my invoice data : gncInvoice, gncBillTerm, Account,
Transaction, gncCustomer, gncJob, everything referenced by a gncInvoice is
copied. Once sorted, I'll see about exporting individual invoices in this
way. Right now, I've still got awkward problems with collections.
--
Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/
pgpymnPtAFTtG.pgp
Description: PGP signature
_______________________________________________ gnucash-devel mailing list [email protected] https://lists.gnucash.org/mailman/listinfo/gnucash-devel
