Version 1 of Finding out tclConfig.sh

Updated 2004-11-13 15:45:21 by Googie

Lets exchange here our solutions to finding out tclConfig.sh.

My first candidate is following code:

 foreach d "
     $tcl_library
     [lindex $tcl_pkgPath 0]
     $auto_path
     [file dirname $tcl_library]
     [file dirname [lindex $tcl_pkgPath 0]]
     [file dirname [file dirname $tcl_library]]
     [file dirname [file dirname [lindex $tcl_pkgPath 0]]]
     [file dirname [file dirname [file dirname $tcl_library]]]
     [file dirname [file dirname [file dirname [lindex $tcl_pkgPath 0]]]]
 " {
     if {[file exists [file join $d tclConfig.sh]]} {
         puts "[file join $d tclConfig.sh]"
         exit
     }
 }

 puts "none"

We can put it into the one tcl script file and execute from a shell to get info, if we can find tclConfig.sh (returns path pointing to it) or we can't (returns "none"). I use few levels of file dirname for $tcl_library and $tcl_pkgPath, becouse of some problems on MacOS (tclConfig.sh is places few levels upper than $tcl_library).