Use another way to fix backend loading on OS X

This commit is contained in:
Geert Janssens
2017-08-17 10:10:50 +02:00
parent cc39a04f6f
commit 0946b0315f
2 changed files with 4 additions and 4 deletions

View File

@@ -74,9 +74,9 @@ gnc_engine_init_part2()
} libs[] =
{
#if defined( HAVE_DBI_DBI_H )
{ "gnucash", "gncmod-backend-dbi", TRUE },
{ "dbi", "gncmod-backend-dbi", TRUE },
#endif
{ "gnucash", "gncmod-backend-xml", TRUE },
{ "xml", "gncmod-backend-xml", TRUE },
{ NULL, FALSE }
}, *lib;

View File

@@ -137,16 +137,16 @@ QofBackend::register_backend(const char* directory, const char* module_name)
if (!absdir || !g_path_is_absolute(absdir))
absdir = get_default_module_dir(directory);
auto fullpath = g_module_build_path (absdir, module_name);
g_free (absdir);
/* Darwin modules can have either .so or .dylib for a suffix */
if (!g_file_test (fullpath, G_FILE_TEST_EXISTS) &&
g_strcmp0 (G_MODULE_SUFFIX, "so") == 0)
{
auto modname = g_strdup_printf ("lib%s.dylib", module_name);
g_free (fullpath);
fullpath = g_build_filename (directory, modname, NULL);
fullpath = g_build_filename (absdir, modname, NULL);
g_free (modname);
}
g_free (absdir);
auto backend = g_module_open (fullpath, G_MODULE_BIND_LAZY);
g_free (fullpath);
if (!backend)