summaryrefslogtreecommitdiffstats
path: root/library/init.tcl
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2017-01-04 16:23:23 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2017-01-04 16:23:23 (GMT)
commit9f5fab9296c69ae125f5d288a5cca0d1dc3321ec (patch)
tree159bdd1c58c9819216cc696df735b5b0f7b5396d /library/init.tcl
parent707993b1dd4f01322cdbea334c71a1202373fa9b (diff)
downloadtcl-9f5fab9296c69ae125f5d288a5cca0d1dc3321ec.zip
tcl-9f5fab9296c69ae125f5d288a5cca0d1dc3321ec.tar.gz
tcl-9f5fab9296c69ae125f5d288a5cca0d1dc3321ec.tar.bz2
In stead of "source -nopkg" use a ::tcl::Pkg::source utility function.
Diffstat (limited to 'library/init.tcl')
-rw-r--r--library/init.tcl24
1 files changed, 22 insertions, 2 deletions
diff --git a/library/init.tcl b/library/init.tcl
index e3d4ef0..9101e35 100644
--- a/library/init.tcl
+++ b/library/init.tcl
@@ -46,8 +46,6 @@ if {![info exists auto_path]} {
}
}
-source [file join $::tcl_library auto.tcl]
-
namespace eval tcl {
variable Dir
foreach Dir [list $::tcl_library [file dirname $::tcl_library]] {
@@ -115,6 +113,8 @@ namespace eval tcl {
}
}
+namespace eval tcl::Pkg {}
+
# Windows specific end of initialization
if {(![interp issafe]) && ($tcl_platform(platform) eq "windows")} {
@@ -460,6 +460,26 @@ 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 {
+ set f [open $filename]
+ fconfigure $f -eofchar \032
+ set contents [read $f]
+ close $f
+ uplevel 1 [list eval $contents]
+ }
+}
+
# 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