+2008-10-15 Steve Huntley <stephen.huntley@alum.mit.edu>
+
+ vfs::template package update ver. 1.5.3:
+
+ * templatevfs.tcl: Incorporated AK's fix below.
+ * collatevfs.tcl: ensured binary file contents got written
+ correctly, and ensured that not only file contents but
+ also file attributes were updated to all write targets.
+
2009-07-06 Andreas Kupries <andreask@activestate.com>
* library/template/templatevfs.tcl (memchan): Fix result for
Written by Stephen Huntley (stephen.huntley@alum.mit.edu)
License: Tcl license
-Version 1.5
+Version 1.5.3
A collate/broadcast/collect/catchup virtual filesystem. Requires the template vfs in templatevfs.tcl.
}
package require vfs::template 1.5
-package provide vfs::template::collate 1.5.2
namespace eval ::vfs::template::collate {
proc close_ {channel} {
upvar root root relative relative
foreach file [lrange [WriteFile $root $relative close] 1 end] {
+ if ![WriteTest $file] {continue}
+ file mkdir [file dirname $file]
set f [open $file w]
+ fconfigure $f -translation binary
seek $channel 0
fcopy $channel $f
close $f
}
proc file_atime {file time} {
upvar root root relative relative
- set file [AcquireFile $root $relative]
- file atime $file $time
+ foreach file [WriteFile $root $relative open] {
+ file atime $file $time
+ }
}
proc file_mtime {file time} {
upvar root root relative relative
- set file [AcquireFile $root $relative]
- file mtime $file $time
+ foreach file [WriteFile $root $relative open] {
+ file mtime $file $time
+ }
}
proc file_attributes {file {attribute {}} args} {
upvar root root relative relative
- set file [AcquireFile $root $relative]
if {($relative == {}) && ([string map {-read 1 -write 1 -collect 1 -catchup 1} $attribute] == 1)} {
set attribute [string range $attribute 1 end]
if {$args == {}} {eval return \$::vfs::template::collate::${attribute}(\$root)}
set ::vfs::template::collate::catchup [file isdirectory [lindex $::vfs::template::collate::catchupstore 0]]
return
}
+ if {$args != {}} {
+ foreach file [WriteFile $root $relative open] {
+ file attributes $file $attribute $args
+ }
+ return
+ }
+ set file [AcquireFile $root $relative]
set returnValue [eval file attributes \$file $attribute $args]
if {($relative == {}) && ($attribute == {})} {set returnValue [concat $returnValue [list -read $::vfs::template::collate::read($root) -write $::vfs::template::collate::write($root) -collect $::vfs::template::collate::collect($root) -catchup $::vfs::template::collate::catchupstore($root)]]}
return $returnValue
return $returnValue
}
+proc WriteTest {args} {
+ return 1
+}
+
}
# end namespace ::vfs::template::collate