summaryrefslogtreecommitdiffstats
path: root/library/init.tcl
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-07-11 16:06:44 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-07-11 16:06:44 (GMT)
commitb8bffd00e36251f0126d02b73f1e84c24b912ab9 (patch)
tree877b12f08f4266c9a01b6068d7e0e3a0fb80d520 /library/init.tcl
parenta0457efe80223c1380e9e0fc6a50c755fc7bbeda (diff)
parent2ead5632823207539bb83b296fb903b63ec595ff (diff)
downloadtcl-b8bffd00e36251f0126d02b73f1e84c24b912ab9.zip
tcl-b8bffd00e36251f0126d02b73f1e84c24b912ab9.tar.gz
tcl-b8bffd00e36251f0126d02b73f1e84c24b912ab9.tar.bz2
Merge 8.6
Diffstat (limited to 'library/init.tcl')
-rw-r--r--library/init.tcl45
1 files changed, 25 insertions, 20 deletions
diff --git a/library/init.tcl b/library/init.tcl
index 5cc0fee..e6964e0 100644
--- a/library/init.tcl
+++ b/library/init.tcl
@@ -37,41 +37,46 @@ package require -exact Tcl 8.6.10
# tcl_pkgPath, which is set by the platform-specific initialization routines
# On UNIX it is compiled in
# On Windows, it is not used
+#
+# (Ticket 41c9857bdd) In a safe interpreter, this file does not set
+# ::auto_path (other than to {} if it is undefined). The caller, typically
+# a Safe Base command, is responsible for setting ::auto_path.
if {![info exists auto_path]} {
- if {[info exists env(TCLLIBPATH)]} {
+ if {[info exists env(TCLLIBPATH)] && (![interp issafe])} {
set auto_path $env(TCLLIBPATH)
} else {
set auto_path ""
}
}
namespace eval tcl {
- variable Dir
- foreach Dir [list $::tcl_library [file dirname $::tcl_library]] {
- if {$Dir ni $::auto_path} {
- lappend ::auto_path $Dir
- }
- }
- set Dir [file join [file dirname [file dirname \
- [info nameofexecutable]]] lib]
- if {$Dir ni $::auto_path} {
- lappend ::auto_path $Dir
- }
- if {[info exists ::tcl_pkgPath]} { catch {
- foreach Dir $::tcl_pkgPath {
+ if {![interp issafe]} {
+ variable Dir
+ foreach Dir [list $::tcl_library [file dirname $::tcl_library]] {
if {$Dir ni $::auto_path} {
lappend ::auto_path $Dir
}
}
- }}
+ set Dir [file join [file dirname [file dirname \
+ [info nameofexecutable]]] lib]
+ if {$Dir ni $::auto_path} {
+ lappend ::auto_path $Dir
+ }
+ if {[info exists ::tcl_pkgPath]} { catch {
+ foreach Dir $::tcl_pkgPath {
+ if {$Dir ni $::auto_path} {
+ lappend ::auto_path $Dir
+ }
+ }
+ }}
- if {![interp issafe]} {
- variable Path [encoding dirs]
- set Dir [file join $::tcl_library encoding]
- if {$Dir ni $Path} {
+ variable Path [encoding dirs]
+ set Dir [file join $::tcl_library encoding]
+ if {$Dir ni $Path} {
lappend Path $Dir
encoding dirs $Path
- }
+ }
+ unset Dir Path
}
# TIP #255 min and max functions