2012-06-13 10:19:44 -05:00
|
|
|
--- misc/liblangtag-0.2/liblangtag/lt-database.c 2012-01-31 11:27:16.000000000 +0100
|
|
|
|
+++ misc/build/liblangtag-0.2/liblangtag/lt-database.c 2012-06-12 01:32:57.354123185 +0200
|
|
|
|
@@ -26,6 +26,7 @@
|
|
|
|
#include "lt-mem.h"
|
|
|
|
#include "lt-ext-module.h"
|
|
|
|
#include "lt-database.h"
|
|
|
|
+#include <string.h>
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -44,10 +45,41 @@
|
|
|
|
static lt_grandfathered_db_t *__db_grandfathered = NULL;
|
|
|
|
static lt_redundant_db_t *__db_redundant = NULL;
|
|
|
|
|
|
|
|
+/* this is a hack and might need some proper runtime de/allocation, but ... */
|
|
|
|
+#define DATADIR_MAX_PATH_LEN 512
|
|
|
|
+static char lt_db_datadir[DATADIR_MAX_PATH_LEN] = { 0 };
|
|
|
|
+
|
|
|
|
|
|
|
|
/*< private >*/
|
|
|
|
|
|
|
|
/*< public >*/
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * lt_db_set_datadir:
|
|
|
|
+ *
|
|
|
|
+ * Set the directory where database files are installed.
|
|
|
|
+ * This overrides the default prefix= location if called before
|
|
|
|
+ * lt_db_initialize().
|
|
|
|
+ */
|
|
|
|
+void
|
|
|
|
+lt_db_set_datadir(const char* path)
|
|
|
|
+{
|
|
|
|
+ strncpy( lt_db_datadir, path, DATADIR_MAX_PATH_LEN-1);
|
|
|
|
+ lt_db_datadir[DATADIR_MAX_PATH_LEN-1] = 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * lt_db_get_datadir:
|
|
|
|
+ *
|
|
|
|
+ * Obtain the directory where database files are installed.
|
|
|
|
+ * Only if set with lt_db_set_datadir().
|
|
|
|
+ */
|
|
|
|
+const char*
|
|
|
|
+lt_db_get_datadir(void)
|
|
|
|
+{
|
|
|
|
+ return lt_db_datadir;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
* lt_db_initialize:
|
|
|
|
*
|
|
|
|
--- misc/liblangtag-0.2/liblangtag/lt-database.h 2012-01-31 11:27:04.000000000 +0100
|
|
|
|
+++ misc/build/liblangtag-0.2/liblangtag/lt-database.h 2012-06-12 00:23:04.345618028 +0200
|
|
|
|
@@ -37,6 +37,8 @@
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
+void lt_db_set_datadir (const char*);
|
|
|
|
+const char* lt_db_get_datadir (void);
|
|
|
|
void lt_db_initialize (void);
|
|
|
|
void lt_db_finalize (void);
|
|
|
|
lt_lang_db_t *lt_db_get_lang (void);
|
2012-06-04 16:28:55 -05:00
|
|
|
--- misc/liblangtag-0.2/liblangtag/lt-xml.c 2012-02-02 09:54:51.000000000 +0100
|
2012-06-13 10:19:44 -05:00
|
|
|
+++ misc/build/liblangtag-0.2/liblangtag/lt-xml.c 2012-06-12 00:23:04.477618565 +0200
|
|
|
|
@@ -45,7 +45,20 @@
|
2012-06-04 16:28:55 -05:00
|
|
|
|
|
|
|
G_LOCK_DEFINE_STATIC (lt_xml);
|
|
|
|
|
2012-06-13 10:19:44 -05:00
|
|
|
+
|
|
|
|
+/* defined in lt-database.c */
|
|
|
|
+extern const char* lt_db_get_datadir(void);
|
|
|
|
+
|
|
|
|
/*< private >*/
|
|
|
|
+static const char*
|
|
|
|
+lt_xml_get_datadir()
|
2012-06-04 16:28:55 -05:00
|
|
|
+{
|
2012-06-13 10:19:44 -05:00
|
|
|
+ const char* datadir = lt_db_get_datadir();
|
|
|
|
+ if (datadir && *datadir)
|
|
|
|
+ return datadir;
|
2012-06-04 16:28:55 -05:00
|
|
|
+ return REGDATADIR;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
static gboolean
|
|
|
|
lt_xml_read_subtag_registry(lt_xml_t *xml,
|
2012-06-13 10:19:44 -05:00
|
|
|
GError **error)
|
|
|
|
@@ -62,7 +75,7 @@
|
2012-06-04 16:28:55 -05:00
|
|
|
if (!g_file_test(regfile, G_FILE_TEST_EXISTS)) {
|
|
|
|
g_free(regfile);
|
|
|
|
#endif
|
|
|
|
- regfile = g_build_filename(REGDATADIR, "language-subtag-registry.xml", NULL);
|
2012-06-13 10:19:44 -05:00
|
|
|
+ regfile = g_build_filename(lt_xml_get_datadir(), "language-subtag-registry.xml", NULL);
|
2012-06-04 16:28:55 -05:00
|
|
|
#ifdef GNOME_ENABLE_DEBUG
|
|
|
|
}
|
|
|
|
#endif
|
2012-06-13 10:19:44 -05:00
|
|
|
@@ -120,7 +133,7 @@
|
2012-06-04 16:28:55 -05:00
|
|
|
if (!g_file_test(regfile, G_FILE_TEST_EXISTS)) {
|
|
|
|
g_free(regfile);
|
|
|
|
#endif
|
|
|
|
- regfile = g_build_filename(REGDATADIR, "common", "bcp47", filename, NULL);
|
2012-06-13 10:19:44 -05:00
|
|
|
+ regfile = g_build_filename(lt_xml_get_datadir(), "common", "bcp47", filename, NULL);
|
2012-06-04 16:28:55 -05:00
|
|
|
#ifdef GNOME_ENABLE_DEBUG
|
|
|
|
}
|
|
|
|
#endif
|