1 --- misc/liblangtag-0.2/liblangtag/lt-database.c 2012-01-31 11:27:16.000000000 +0100
2 +++ misc/build/liblangtag-0.2/liblangtag/lt-database.c 2012-06-12 01:32:57.354123185 +0200
5 #include "lt-ext-module.h"
6 #include "lt-database.h"
12 static lt_grandfathered_db_t *__db_grandfathered = NULL;
13 static lt_redundant_db_t *__db_redundant = NULL;
15 +/* this is a hack and might need some proper runtime de/allocation, but ... */
16 +#define DATADIR_MAX_PATH_LEN 512
17 +static char lt_db_datadir[DATADIR_MAX_PATH_LEN] = { 0 };
25 + * lt_db_set_datadir:
27 + * Set the directory where database files are installed.
28 + * This overrides the default prefix= location if called before
29 + * lt_db_initialize().
32 +lt_db_set_datadir(const char* path)
34 + strncpy( lt_db_datadir, path, DATADIR_MAX_PATH_LEN-1);
35 + lt_db_datadir[DATADIR_MAX_PATH_LEN-1] = 0;
39 + * lt_db_get_datadir:
41 + * Obtain the directory where database files are installed.
42 + * Only if set with lt_db_set_datadir().
45 +lt_db_get_datadir(void)
47 + return lt_db_datadir;
53 --- misc/liblangtag-0.2/liblangtag/lt-database.h 2012-01-31 11:27:04.000000000 +0100
54 +++ misc/build/liblangtag-0.2/liblangtag/lt-database.h 2012-06-12 00:23:04.345618028 +0200
59 +void lt_db_set_datadir (const char*);
60 +const char* lt_db_get_datadir (void);
61 void lt_db_initialize (void);
62 void lt_db_finalize (void);
63 lt_lang_db_t *lt_db_get_lang (void);
64 --- misc/liblangtag-0.2/liblangtag/lt-xml.c 2012-02-02 09:54:51.000000000 +0100
65 +++ misc/build/liblangtag-0.2/liblangtag/lt-xml.c 2012-06-12 00:23:04.477618565 +0200
68 G_LOCK_DEFINE_STATIC (lt_xml);
71 +/* defined in lt-database.c */
72 +extern const char* lt_db_get_datadir(void);
78 + const char* datadir = lt_db_get_datadir();
79 + if (datadir && *datadir)
85 lt_xml_read_subtag_registry(lt_xml_t *xml,
88 if (!g_file_test(regfile, G_FILE_TEST_EXISTS)) {
91 - regfile = g_build_filename(REGDATADIR, "language-subtag-registry.xml", NULL);
92 + regfile = g_build_filename(lt_xml_get_datadir(), "language-subtag-registry.xml", NULL);
93 #ifdef GNOME_ENABLE_DEBUG
97 if (!g_file_test(regfile, G_FILE_TEST_EXISTS)) {
100 - regfile = g_build_filename(REGDATADIR, "common", "bcp47", filename, NULL);
101 + regfile = g_build_filename(lt_xml_get_datadir(), "common", "bcp47", filename, NULL);
102 #ifdef GNOME_ENABLE_DEBUG