r14785 - gnucash/trunk/lib/libqof/qof - For windows, fall back to the file backend if a colon was in the URL name.
Christian Stimming
stimming at tuhh.de
Wed Sep 13 16:20:48 EDT 2006
Am Mittwoch, 13. September 2006 18:01 schrieb Derek Atkins:
> Christian Stimming <cstim at cvs.gnucash.org> writes:
> > Log:
> > For windows, fall back to the file backend if a colon was in the URL
> > name.
>
> I'm wondering if we should only fallback if the colon is in position
> 1? I think it's only valid to have "C:" (where "C" can be "[A-Z]"),
> but I dont think the colon is valid in any other location.
Yes, but OTOH the access_method code doesn't check for the length of the
string in front of the colon as well. I just continued in the same manner --
the backend is given a try, and if it can't load this path, we know it can't
load it. IMHO there's not really any need for more intelligence here, as I
can't imagine what would go wrong. If you want to add more intelligence, feel
free to do so. Just keep in mind you *must* have a qof_session_clear_error()
before you call qof_session_load_backend() again (as added there by a later
commit).
Christian
>
> > Modified: gnucash/trunk/lib/libqof/qof/qofsession.c
> > ===================================================================
> > --- gnucash/trunk/lib/libqof/qof/qofsession.c 2006-09-02 15:44:45 UTC
> > (rev 14784) +++ gnucash/trunk/lib/libqof/qof/qofsession.c 2006-09-02
> > 19:18:27 UTC (rev 14785) @@ -1006,6 +1006,15 @@
> > *p = '\0';
> > qof_session_load_backend(session, access_method);
> > g_free (access_method);
> > +#if G_OS_WIN32
> > + if (NULL == session->backend)
> > + {
> > + /* On windows, a colon can be part of a normal filename. So if
> > + no backend was found (which means the part before the colon
> > + wasn't an access method), fall back to the file backend. */
> > + qof_session_load_backend(session, "file");
> > + }
> > +#endif
>
> -derek
More information about the gnucash-devel
mailing list