diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-01-04 16:23:23 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-01-04 16:23:23 (GMT) |
commit | 5e02396d5e59a51aa2c1e0cc1adf72c84783b268 (patch) | |
tree | 159bdd1c58c9819216cc696df735b5b0f7b5396d /library/init.tcl | |
parent | 2e108cd831c0768e78523e91979084cad3655df6 (diff) | |
download | tcl-5e02396d5e59a51aa2c1e0cc1adf72c84783b268.zip tcl-5e02396d5e59a51aa2c1e0cc1adf72c84783b268.tar.gz tcl-5e02396d5e59a51aa2c1e0cc1adf72c84783b268.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.tcl | 24 |
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 |