Index: openacs-4/packages/acs-templating/tcl/spellcheck-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/spellcheck-init.tcl,v diff -u -r1.14 -r1.15 --- openacs-4/packages/acs-templating/tcl/spellcheck-init.tcl 19 Jan 2008 20:36:33 -0000 1.14 +++ openacs-4/packages/acs-templating/tcl/spellcheck-init.tcl 20 Jan 2008 19:31:37 -0000 1.15 @@ -9,24 +9,10 @@ } # Find the aspell or, second best, the ispell binary. -# In case neither one is found, spell-checking will be disabled. - -# DRB: The original code here apparently was written under the delusion -# that using "catch" to guard calls to "exec" would allow one to safely use -# the same "exec" elsewhere in the same command, as though Tcl does short-circuit -# evaluation of exprs. I only mention this in case someone sees the clever (but wrong) -# code and decides they want to replace my fix with the clever (but wrong) version ... - -# DRB: And to top it off, OS/X (all BSD?) "which" doesn't return an error, just an -# error string, if the file doesn't exist, making the check even more fun to run. - -expr { ![catch {exec which aspell}] && ![string match "*no aspell*" [exec which aspell]] } -if { ![catch {exec which aspell}] && ![string match "*no aspell*" [exec which aspell]] } { - set bin [exec which aspell] -} elseif { ![catch {exec which ispell}] && ![string match "*no ispell*" [exec which ispell]] } { - set bin [exec which ispell] -} else { - set bin "" +# In case neither one is found, bin is empty and spell-checking will be disabled. +set bin [::util::which aspell] +if {$bin eq ""} { + set bin [::util::which ispell] } # Do we want dialect dictionaries (if available) or not? @@ -40,7 +26,7 @@ # aspell or ispell? set dicts "" set default_lang "" -if { [regexp aspell $bin] } { +if { [string match "*aspell" $bin] } { # aspell with_catch errmsg { set dicts [exec $bin dump dicts] @@ -55,7 +41,7 @@ ns_log Warning "Gettings dicts and default_lang for aspell failed with error message: \"$errmsg\"" ns_log Notice "You might want to upgrade to a more recent version of Aspell ... http://aspell.sourceforge.net/" } -} elseif { [regexp ispell $bin] } { +} elseif { [string match "*ispell" $bin] } { # ispell - if someone knows how to get the available dictionaries and the # default language from ispell, please add it here :-) set dicts ""