summaryrefslogtreecommitdiffstats
path: root/packaging/macos/modulesets/patches/enchant-relocatable.patch
blob: 602b5c1f01e6657bef9022085f443ba0aae7cf00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
diff --git a/src/lib.c b/src/lib.c
index d9d3c54..ae3642f 100644
--- a/src/lib.c
+++ b/src/lib.c
@@ -130,6 +130,10 @@ enchant_get_conf_dirs (void)
 	char *pkgconfdir = NULL;
 	char *user_config_dir = NULL;
 
+	const char *prefix = g_getenv("ENCHANT_PREFIX");
+	if (prefix)
+		conf_dirs = g_slist_append(conf_dirs, g_build_filename(prefix, "/share/enchant", NULL));
+
 	if ((pkgdatadir = enchant_relocate (PKGDATADIR)) == NULL)
 		goto error_exit;
 	conf_dirs = g_slist_append (conf_dirs, pkgdatadir);
@@ -148,6 +152,7 @@ enchant_get_conf_dirs (void)
 	return conf_dirs;
 
  error_exit:
+	g_warning("error_exit in enchant_get_conf_dirs");
 	free (pkgdatadir);
 	free (sysconfdir);
 	g_free (pkgconfdir);
@@ -878,7 +883,13 @@ enchant_load_providers_in_dir (EnchantBroker * broker, const char *dir_name)
 static void
 enchant_load_providers (EnchantBroker * broker)
 {
-	char *module_dir = enchant_relocate (PKGLIBDIR "-" ENCHANT_MAJOR_VERSION);
+	const char *prefix = g_getenv("ENCHANT_PREFIX");
+	char *module_dir = NULL;
+	if (prefix)
+		module_dir = g_build_filename(prefix, "/lib/enchant-2", NULL);
+	else
+		module_dir = enchant_relocate (PKGLIBDIR "-" ENCHANT_MAJOR_VERSION);
+
 	if (module_dir)
 		enchant_load_providers_in_dir (broker, module_dir);
 	free (module_dir);