]> granicus.if.org Git - php/commitdiff
This should allow us to read dictionary locations from the win32 registry when we...
authorVlad Krupin <vlad@php.net>
Tue, 3 Feb 2004 05:40:25 +0000 (05:40 +0000)
committerVlad Krupin <vlad@php.net>
Tue, 3 Feb 2004 05:40:25 +0000 (05:40 +0000)
Not doing so when I added win32 support was an oversight.
Now all pspell_new_* functions should be usable on win32.

ext/pspell/pspell.c

index e920d9b10b26171171b6ad6bd99d9d93a90962da..8673e844dcf6b4d103e2489a4afbab68c11b017e 100644 (file)
@@ -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));