summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorstanton <stanton>1999-02-02 22:28:10 (GMT)
committerstanton <stanton>1999-02-02 22:28:10 (GMT)
commite8f0296a2548aa311e6b46b619835532813f4bc0 (patch)
tree0af36d64529237b6b1765f38d220a57f2bea25db /library
parenta26fbfadc3ddf551d4c89b2febaf94080ca4954f (diff)
downloadtcl-e8f0296a2548aa311e6b46b619835532813f4bc0.zip
tcl-e8f0296a2548aa311e6b46b619835532813f4bc0.tar.gz
tcl-e8f0296a2548aa311e6b46b619835532813f4bc0.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]
Diffstat (limited to 'library')
-rw-r--r--library/init.tcl25
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]]
}
}
}