mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Check for QOF_LIB_DIR environment variable and try to load qof backends from there first.
This is a minimally invasive way to make qof backends relocatable and needed for the Windows port. Avoiding qofla-dir.h completely is probably desirable anyway. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@16141 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
ed8b853ef0
commit
c24fca6d1e
@ -871,20 +871,34 @@ qof_session_load_backend(QofSession * session, char * access_method)
|
||||
gint num;
|
||||
gboolean prov_type;
|
||||
gboolean (*type_check) (const char*);
|
||||
|
||||
gchar *libdir_from_env = NULL;
|
||||
|
||||
ENTER (" list=%d, initted=%s", g_slist_length(provider_list),
|
||||
qof_providers_initialized ? "true" : "false");
|
||||
prov_type = FALSE;
|
||||
if (!qof_providers_initialized)
|
||||
{
|
||||
libdir_from_env = g_strdup(g_getenv("QOF_LIB_DIR"));
|
||||
for (num = 0; backend_list[num].filename != NULL; num++) {
|
||||
if(!qof_load_backend_library(backend_list[num].libdir,
|
||||
backend_list[num].filename))
|
||||
{
|
||||
PWARN (" failed to load %s from %s",
|
||||
backend_list[num].filename, backend_list[num].libdir);
|
||||
if (libdir_from_env) {
|
||||
if (!(qof_load_backend_library(libdir_from_env,
|
||||
backend_list[num].filename)
|
||||
|| qof_load_backend_library(backend_list[num].libdir,
|
||||
backend_list[num].filename)))
|
||||
{
|
||||
PWARN (" failed to load %s from %s or %s",
|
||||
backend_list[num].filename, libdir_from_env,
|
||||
backend_list[num].libdir);
|
||||
}
|
||||
} else {
|
||||
if (!qof_load_backend_library(backend_list[num].libdir,
|
||||
backend_list[num].filename)) {
|
||||
PWARN (" failed to load %s from %s",
|
||||
backend_list[num].filename, backend_list[num].libdir);
|
||||
}
|
||||
}
|
||||
}
|
||||
g_free(libdir_from_env);
|
||||
qof_providers_initialized = TRUE;
|
||||
}
|
||||
p = provider_list;
|
||||
|
Loading…
Reference in New Issue
Block a user