summaryrefslogtreecommitdiff
path: root/ext/pspell
diff options
context:
space:
mode:
authorVlad Krupin <vlad@php.net>2004-02-03 05:40:25 +0000
committerVlad Krupin <vlad@php.net>2004-02-03 05:40:25 +0000
commit66ebc334d60c60009614b6c31830ca631c5f371a (patch)
tree0eba4327b9e048747065882cbcd3e9157f084222 /ext/pspell
parent6dca37c50c399ed619bb5287c3f3afdfb2f9b84d (diff)
downloadphp-git-66ebc334d60c60009614b6c31830ca631c5f371a.tar.gz
This should allow us to read dictionary locations from the win32 registry when we use a custom config.
Not doing so when I added win32 support was an oversight. Now all pspell_new_* functions should be usable on win32.
Diffstat (limited to 'ext/pspell')
-rw-r--r--ext/pspell/pspell.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/ext/pspell/pspell.c b/ext/pspell/pspell.c
index e920d9b10b..8673e844dc 100644
--- a/ext/pspell/pspell.c
+++ b/ext/pspell/pspell.c
@@ -627,7 +627,33 @@ PHP_FUNCTION(pspell_config_create)
WRONG_PARAM_COUNT;
}
+#ifdef PHP_WIN32
+ TCHAR aspell_dir[200];
+ TCHAR data_dir[220];
+ TCHAR dict_dir[220];
+ HKEY hkey;
+ DWORD dwType,dwLen;
+#endif
+
config = new_pspell_config();
+
+#ifdef PHP_WIN32
+ /* If aspell was installed using installer, we should have a key
+ * pointing to the location of the dictionaries
+ */
+ if(0 == RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\Aspell", &hkey)) {
+ RegQueryValueEx(hkey, "", NULL, &dwType, (LPBYTE)&aspell_dir, &dwLen);
+ RegCloseKey(hkey);
+ strcpy(data_dir, aspell_dir);
+ strcat(data_dir, "\\data");
+ strcpy(dict_dir, aspell_dir);
+ strcat(dict_dir, "\\dict");
+
+ pspell_config_replace(config, "data-dir", data_dir);
+ pspell_config_replace(config, "dict-dir", dict_dir);
+ }
+#endif
+
convert_to_string_ex(language);
pspell_config_replace(config, "language-tag", Z_STRVAL_PP(language));