[gtk-osx-devel] [PATCH] make enchant to look for modules/configs in env specified dirs



currently library looks for dictionary modules libraries and configs
only at hardcoded places i.e. at isnstall prefix and $HOME.

However it doesn't work when bundled application is moved to
system without gtk-osx build env or it's moved to another place.

Teach library check addtional pathes provided via env variables:
ENCHANT_MODULE_PATH/ENCHANT_CONFIG_PATH
which should be set by luncher script of the bundle to point
at spelling modules/configs directories.

Signed-off-by: Igor Mammedov <imammedo redhat com>
---
 modulesets-stable/gtk-osx-unsupported.modules |  1 +
 patches/enchant-env.patch                     | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 patches/enchant-env.patch

diff --git a/modulesets-stable/gtk-osx-unsupported.modules b/modulesets-stable/gtk-osx-unsupported.modules
index 95bc531..a3b1b04 100644
--- a/modulesets-stable/gtk-osx-unsupported.modules
+++ b/modulesets-stable/gtk-osx-unsupported.modules
@@ -126,6 +126,7 @@
     <branch module="1.6.0/enchant-1.6.0.tar.gz" version="1.6.0"
            repo="abisource/enchant">
  <patch file="http://git.gnome.org/browse/gtk-osx/plain/patches/enchant-gsize.patch"; strip="1"/>
+ <patch file="http://git.gnome.org/browse/gtk-osx/plain/patches/enchant-env.patch"; strip="1"/>
     </branch>
     <dependencies>
       <dep package="glib"/>
diff --git a/patches/enchant-env.patch b/patches/enchant-env.patch
new file mode 100644
index 0000000..7cae667
--- /dev/null
+++ b/patches/enchant-env.patch
@@ -0,0 +1,26 @@
+diff --git a/src/enchant.c b/src/enchant.c
+index 79fb21c..8a1b100 100644
+--- a/src/enchant.c
++++ b/src/enchant.c
+@@ -251,6 +251,10 @@ enchant_get_module_dirs (void)
+               }
+ #endif
+ 
++      module_dir = g_getenv("ENCHANT_MODULE_PATH");
++      if (module_dir)
++              module_dirs = enchant_slist_append_unique_path (module_dirs, g_strdup(module_dir));
++
+       return module_dirs;
+ }
+ 
+@@ -291,6 +295,10 @@ enchant_get_conf_dirs (void)
+       conf_dirs = enchant_slist_append_unique_path (conf_dirs, g_strdup (ENCHANT_GLOBAL_ORDERING));
+ #endif
+ 
++      ordering_dir = g_getenv("ENCHANT_CONFIG_PATH");
++      if (ordering_dir)
++              conf_dirs = enchant_slist_append_unique_path (conf_dirs, g_strdup(ordering_dir));
++
+       return conf_dirs;
+ }
+ 
-- 
1.9.3 (Apple Git-50)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]