diff options
author | stanton <stanton@noemail.net> | 1999-02-02 22:28:09 (GMT) |
---|---|---|
committer | stanton <stanton@noemail.net> | 1999-02-02 22:28:09 (GMT) |
commit | ec674858a254ea6fe928287fe1adb95d17c3a65b (patch) | |
tree | 0af36d64529237b6b1765f38d220a57f2bea25db /library/init.tcl | |
parent | ccb9402700b710a23919666516d382b00aa9d790 (diff) | |
download | tcl-ec674858a254ea6fe928287fe1adb95d17c3a65b.zip tcl-ec674858a254ea6fe928287fe1adb95d17c3a65b.tar.gz tcl-ec674858a254ea6fe928287fe1adb95d17c3a65b.tar.bz2 |
* library/init.tcl: Various small changes requested by Jan Nijtmans.
- If the variable $tcl_library contains the empty string, this
empty string will be put in $auto_path. This is not useful at all,
it only slows down later package processing.
- If the variable tcl_pkgPath is not set, the "unset __dir"
fails. Thich makes init.tcl totally unusable. Better put a "catch"
around it.
- In the function tcl_findLibraries, the "string match" function
only works correctly if $tcl_patchLevel is in one of the forms
"?.?a?", "?.?b?" or "?.?.?". Could a "regexp" be used instead,
then it allows anything to be appended to the patchLevel
string. And it is more efficient.
- The tclPkgSetup function assumes that if $type != "load" then
the type must be "source". This needn't be true. Some users want
to add their own setup types.
[RFE: 1138] [Bug: 978]
FossilOrigin-Name: f3d065fb9d636ea7906719137e29fbb7a81f73b2
Diffstat (limited to 'library/init.tcl')
-rw-r--r-- | library/init.tcl | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/library/init.tcl b/library/init.tcl index ce420e4..99afd97 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -3,7 +3,7 @@ # Default system startup file for Tcl-based applications. Defines # "unknown" procedure and auto-load facilities. # -# RCS: @(#) $Id: init.tcl,v 1.24 1999/02/02 18:36:36 stanton Exp $ +# RCS: @(#) $Id: init.tcl,v 1.25 1999/02/02 22:28:10 stanton Exp $ # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. @@ -42,9 +42,11 @@ if {![info exists auto_path]} { set auto_path "" } } -foreach __dir [list [info library] [file dirname [info library]]] { - if {[lsearch -exact $auto_path $__dir] < 0} { - lappend auto_path $__dir +if {[string compare [info library] {}]} { + foreach __dir [list [info library] [file dirname [info library]]] { + if {[lsearch -exact $auto_path $__dir] < 0} { + lappend auto_path $__dir + } } } if {[info exist tcl_pkgPath]} { @@ -54,7 +56,9 @@ if {[info exist tcl_pkgPath]} { } } } -catch {unset __dir} +if {[info exists __dir]} { + unset __dir +} # Windows specific initialization to handle case isses with envars @@ -611,7 +615,7 @@ proc tcl_findLibrary {basename version patch initScript enVarName varName} { # The C application may have hardwired a path, which we honor - if {[info exist the_library]} { + if {[info exist the_library] && [string compare $the_library {}]} { lappend dirs $the_library } else { @@ -625,7 +629,8 @@ proc tcl_findLibrary {basename version patch initScript enVarName varName} { # 2. Relative to the Tcl library - lappend dirs [file join [file dirname [info library]] $basename$version] + lappend dirs [file join [file dirname [info library]] \ + $basename$version] # 3. Various locations relative to the executable # ../lib/foo1.0 (From bin directory in install hierarchy) @@ -641,9 +646,7 @@ proc tcl_findLibrary {basename version patch initScript enVarName varName} { lappend dirs [file join $grandParentDir lib $basename$version] lappend dirs [file join $parentDir library] lappend dirs [file join $grandParentDir library] - if {[string match {*[ab]*} $patch]} { - set ver $patch - } else { + if {![regexp {.*[ab][0-9]*} $patch ver]} { set ver $version } lappend dirs [file join $grandParentDir $basename$ver library] @@ -1425,7 +1428,7 @@ proc tclPkgSetup {dir pkg version files} { if {$type == "load"} { set auto_index($cmd) [list load [file join $dir $f] $pkg] } else { - set auto_index($cmd) [list source [file join $dir $f]] + set auto_index($cmd) [list $type [file join $dir $f]] } } } |