summaryrefslogtreecommitdiffstats
path: root/library/init.tcl
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2017-11-20 10:30:02 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2017-11-20 10:30:02 (GMT)
commitc19490026d441afb3bbe0b2d209da39655bf212e (patch)
tree5f1ee3e02393980557cb128bed8cd7841401ae5f /library/init.tcl
parentc2eeda3f09a8b05e10e5f8f968fc28bb2dcf3750 (diff)
parentbc3e198cba9e40c015a6acfa992c69434274dde6 (diff)
downloadtcl-c19490026d441afb3bbe0b2d209da39655bf212e.zip
tcl-c19490026d441afb3bbe0b2d209da39655bf212e.tar.gz
tcl-c19490026d441afb3bbe0b2d209da39655bf212e.tar.bz2
Re-base to core-8-branch: This change is fine as-is for Tcl 8.7, I wouldn't recommend it for 8.6 (even though it's only for the changed error-message)
Diffstat (limited to 'library/init.tcl')
-rw-r--r--library/init.tcl27
1 files changed, 23 insertions, 4 deletions
diff --git a/library/init.tcl b/library/init.tcl
index d5beb69..4424087 100644
--- a/library/init.tcl
+++ b/library/init.tcl
@@ -16,7 +16,7 @@
if {[info commands package] == ""} {
error "version mismatch: library\nscripts expect Tcl version 7.5b1 or later but the loaded version is\nonly [info patchlevel]"
}
-package require -exact Tcl 8.6.7
+package require -exact Tcl 8.7a2
# Compute the auto path to use in this interpreter.
# The values on the path come from several locations:
@@ -75,6 +75,8 @@ namespace eval tcl {
}
}
+namespace eval tcl::Pkg {}
+
# Windows specific end of initialization
if {(![interp issafe]) && ($tcl_platform(platform) eq "windows")} {
@@ -421,6 +423,22 @@ proc auto_load {cmd {namespace {}}} {
return 0
}
+# ::tcl::Pkg::source --
+# This procedure provides an alternative "source" command, which doesn't
+# register the file for the "package files" command. Safe interpreters
+# don't have to do anything special.
+#
+# Arguments:
+# filename
+
+proc ::tcl::Pkg::source {filename} {
+ if {[interp issafe]} {
+ uplevel 1 [list ::source $filename]
+ } else {
+ uplevel 1 [list ::source -nopkg $filename]
+ }
+}
+
# auto_load_index --
# Loads the contents of tclIndex files on the auto_path directory
# list. This is usually invoked within auto_load to load the index
@@ -463,7 +481,7 @@ proc auto_load_index {} {
}
set name [lindex $line 0]
set auto_index($name) \
- "source [file join $dir [lindex $line 1]]"
+ "::tcl::Pkg::source [file join $dir [lindex $line 1]]"
}
} else {
error "[file join $dir tclIndex] isn't a proper Tcl index file"
@@ -600,8 +618,9 @@ proc auto_execok name {
}
set auto_execs($name) ""
- set shellBuiltins [list cls copy date del dir echo erase md mkdir \
- mklink rd ren rename rmdir start time type ver vol]
+ set shellBuiltins [list assoc cls copy date del dir echo erase ftype \
+ md mkdir mklink move rd ren rename rmdir start \
+ time type ver vol]
if {[info exists env(PATHEXT)]} {
# Add an initial ; to have the {} extension check first.
set execExtensions [split ";$env(PATHEXT)" ";"]