Attachment "init.patch" to
ticket [572025ffff]
added by
dgp
2002-06-22 01:55:44.
Index: library/init.tcl
===================================================================
RCS file: /cvsroot/tcl/tcl/library/init.tcl,v
retrieving revision 1.51
diff -u -r1.51 init.tcl
--- library/init.tcl 29 Dec 2001 00:52:22 -0000 1.51
+++ library/init.tcl 21 Jun 2002 18:54:47 -0000
@@ -30,8 +30,9 @@
# The parent directory of tcl_library. Adding the parent
# means that packages in peer directories will be found automatically.
#
-# Also add the directory where the executable is located, plus ../lib
-# relative to that path.
+# Also add the directory ../lib relative to the directory where the
+# executable is located. This is meant to find binary packages for the
+# same architecture as the current executable.
#
# tcl_pkgPath, which is set by the platform-specific initialization routines
# On UNIX it is compiled in
@@ -45,66 +46,66 @@
set auto_path ""
}
}
-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
+namespace eval tcl {
+ variable 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
+ }
}
}
-}
-set __dir [file join [file dirname [file dirname \
- [info nameofexecutable]]] lib]
-if {[lsearch -exact $auto_path $__dir] < 0} {
- lappend auto_path $__dir
-}
-if {[info exist tcl_pkgPath]} {
- foreach __dir $tcl_pkgPath {
- if {[lsearch -exact $auto_path $__dir] < 0} {
- lappend auto_path $__dir
+ set Dir [file join [file dirname [file dirname \
+ [info nameofexecutable]]] lib]
+ if {[lsearch -exact $::auto_path $Dir] < 0} {
+ lappend ::auto_path $Dir
+ }
+ if {[info exist ::tcl_pkgPath]} {
+ foreach Dir $::tcl_pkgPath {
+ if {[lsearch -exact $::auto_path $Dir] < 0} {
+ lappend ::auto_path $Dir
+ }
}
}
}
-if {[info exists __dir]} {
- unset __dir
-}
# Windows specific end of initialization
if {(![interp issafe]) && [string equal $tcl_platform(platform) "windows"]} {
namespace eval tcl {
- proc envTraceProc {lo n1 n2 op} {
+ proc EnvTraceProc {lo n1 n2 op} {
set x $::env($n2)
set ::env($lo) $x
set ::env([string toupper $lo]) $x
}
- }
- foreach p [array names env] {
- set u [string toupper $p]
- if {[string compare $u $p]} {
- switch -- $u {
- COMSPEC -
- PATH {
- if {![info exists env($u)]} {
- set env($u) $env($p)
+ proc InitWinEnv {} {
+ global env tcl_platform
+ foreach p [array names env] {
+ set u [string toupper $p]
+ if {[string compare $u $p]} {
+ switch -- $u {
+ COMSPEC -
+ PATH {
+ if {![info exists env($u)]} {
+ set env($u) $env($p)
+ }
+ trace variable env($p) w \
+ [namespace code [list EnvTraceProc $p]]
+ trace variable env($u) w \
+ [namespace code [list EnvTraceProc $p]]
+ }
}
- trace variable env($p) w [list tcl::envTraceProc $p]
- trace variable env($u) w [list tcl::envTraceProc $p]
+ }
+ }
+ if {![info exists env(COMSPEC)]} {
+ if {[string equal $tcl_platform(os) "Windows NT"]} {
+ set env(COMSPEC) cmd.exe
+ } else {
+ set env(COMSPEC) command.com
}
}
}
- }
- if {[info exists p]} {
- unset p
- }
- if {[info exists u]} {
- unset u
- }
- if {![info exists env(COMSPEC)]} {
- if {[string equal $tcl_platform(os) "Windows NT"]} {
- set env(COMSPEC) cmd.exe
- } else {
- set env(COMSPEC) command.com
- }
+ InitWinEnv
}
}
@@ -634,8 +635,6 @@
}
-namespace eval tcl {}
-
# ::tcl::CopyDirectory --
#
# This procedure is called by Tcl's core when attempts to call the
@@ -650,7 +649,7 @@
# action - "renaming" or "copying"
# src - source directory
# dest - destination directory
-proc ::tcl::CopyDirectory {action src dest} {
+proc tcl::CopyDirectory {action src dest} {
set nsrc [file normalize $src]
set ndest [file normalize $dest]
if {[string equal $action "renaming"]} {