Posted to tcl by patthoyts at Fri Aug 15 10:26:58 GMT 2008view pretty

# For development, it is very convenient to be able to drop the extra
# packages into the CVS tree. Make sure we have the real location of
# the script and not a link.
set script [file normalize [info script]]
while {[file type $script] eq "link"} {
    set script [file join [file dirname $script] [file readlink $script]]
}
set tkchat_dir [file dirname [file normalize $script]]


# -------------------------------------------------------------------------
# Load in plugins from our directory and ~/.tkchat_plugins or from
# anything in env(TKCHAT_PLUGINS) which may be a tcl list of directories.

set dirs [list $tkchat_dir [file normalize ~/.tkchat_plugins]]
if {[info exists env(TKCHAT_PLUGINS)]} {
    set dirs [linsert $env(TKCHAT_PLUGINS) 0 $tkchat_dir]
}
foreach dir $dirs {
    foreach file [glob -nocomplain -directory $dir \
                      tkchat_*.tcl mousewheel.tcl] {
        if {[file exists $file] && [file readable $file]} {
            if {[catch {source $file} err]} {
                ::bgerror $err
            }
        }
    }
}