summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorhypnotoad <yoda@etoyoc.com>2014-10-21 01:04:07 (GMT)
committerhypnotoad <yoda@etoyoc.com>2014-10-21 01:04:07 (GMT)
commit2c69efbab7882943c1721bba7e17c35bdf65f56f (patch)
tree7532a8a9134f13ff0870ca98e033e741bbf69364 /library
parent9f623a823082706d866519043bdeedd562174549 (diff)
downloadtcl-2c69efbab7882943c1721bba7e17c35bdf65f56f.zip
tcl-2c69efbab7882943c1721bba7e17c35bdf65f56f.tar.gz
tcl-2c69efbab7882943c1721bba7e17c35bdf65f56f.tar.bz2
Replaced calls to zip with calls to the new pure-tcl zipfile encoder embedded
in zvfstools. Fixed a bug in the encoder for zvfstools. It was exporting files, but not directories. This lack of directories was causing the bootloader to miss that /zvfs/boot/tcl/init.tcl existed, because it was checking for the existance of /zvfs/boot/tcl. I compared the archives created by zvfstools::mkzip to the archives created by zip, and the difference came down to the fact that zip did create TOC entries for directories and zvfstools::mkzip was failing to do so. (So I'm pretty sure the new behavior is "standard.")
Diffstat (limited to 'library')
-rw-r--r--library/zvfstools/zvfstools.tcl28
1 files changed, 20 insertions, 8 deletions
diff --git a/library/zvfstools/zvfstools.tcl b/library/zvfstools/zvfstools.tcl
index 05119c6..f755283 100644
--- a/library/zvfstools/zvfstools.tcl
+++ b/library/zvfstools/zvfstools.tcl
@@ -80,6 +80,7 @@ proc ::zvfs::walk {base {excludes ""} {match *} {path {}}} {
if {!$excluded} {lappend result $file}
}
foreach dir [glob -nocomplain -tails -types d -directory $base $imatch] {
+ lappend result $dir
set subdir [walk $base $excludes $match $dir]
if {[llength $subdir]>0} {
set result [concat $result [list $dir] $subdir]
@@ -137,7 +138,7 @@ proc ::zvfs::add_file_to_archive {zipchan base path {comment ""}} {
[string length $utfpath] [string length $extra]]
append local $utfpath $extra
puts -nonewline $zipchan $local
-
+
if {[file isfile $fullpath]} {
# If the file is under 2MB then zip in one chunk, otherwize we use
# streaming to avoid requiring excess memory. This helps to prevent
@@ -242,12 +243,24 @@ proc ::zvfs::mkzip {filename args} {
fcopy $rt $zf
close $rt
} elseif {$opts(-zipkit)} {
- set zkd "#!/usr/bin/env tclkit\n\# This is a zip-based Tcl Module\n"
- append zkd "package require vfs::zip\n"
- append zkd "vfs::zip::Mount \[info script\] \[info script\]\n"
- append zkd "if {\[file exists \[file join \[info script\] main.tcl\]\]} \{\n"
- append zkd " source \[file join \[info script\] main.tcl\]\n"
- append zkd "\}\n"
+ set zkd {#!/usr/bin/env tclsh
+# This is a zip-based Tcl Module
+if {![package vsatisfies [package provide zvfs] 1.0]} {
+ package require vfs::zip
+ vfs::zip::Mount [info script] [info script]
+} else {
+ zvfs::mount [info script] [info script]
+}
+# Load any CLIP file present
+if {[file exists [file join [info script] pkgIndex.tcl]] } {
+ set dir [info script]
+ source [file join [info script] pkgIndex.tcl]
+}
+# Run any main.tcl present
+if {[file exists [file join [info script] main.tcl]] } {
+ source [file join [info script] main.tcl]
+}
+ }
append zkd \x1A
puts -nonewline $zf $zkd
}
@@ -261,7 +274,6 @@ proc ::zvfs::mkzip {filename args} {
set paths [glob -nocomplain {*}$args]
}
foreach path $paths {
- puts $path
append cd [add_file_to_archive $zf $opts(-directory) $path]
incr count
}