lv Question: can anyone provide an example of how one could use the vfs package to poke around a gzipped tar file?
Take a look at the One-line web browser in Tcl for an example of things that can be done.
Using the tclvfs extension, you can now do things like this
package require vfs::urltype vfs::urltype::Mount ftp file copy ftp://foo.bar.com/pub/Readmeor. file copy ftp://user:password@foo.bar.com/private.txt
.
package require vfs::ftp vfs::urltype::Mount ftp set image [image create photo -file ftp://ftp.ucsd.edu/pub/alpha/tcl/alphatk/alphatk.gifor] pack [label .b -image $image]
package require vfs::zip set mnt_file [vfs::zip::Mount foo.zip foo.zip] cd foo.zip ; glob * cd .. vfs::zip::Unmount $mnt_file foo.zipor
package require vfs::urltype vfs::urltype::Mount ftp set listing [glob -dir ftp://ftp.scriptics.com/pubor*]
package require vfs::urltype vfs::urltype::Mount http set fd [open http://sourceforge.net/projects/tclor] set contents [read $fd] ; close $fd
package require vfs::ns vfs::ns::Mount :: :: cd :: set f [open "unknown" r] set proc_definition [read $f] close $f(Caveat: there's a bug in the 0.5 version of the namespace driver that causes glob to return names with the first character missing. cd/open/read seem to work ok though)or nested mounts:
package require vfs::ftp package require vfs::zip vfs::ftp::Mount ftp://ftp.ucsd.edu/pub(Caveat: I haven't actually tried this last one....) MHo: But exec won't work, right?Notice that you need to Mount non-native filesystems before you can use them. There are two kinds of mounts that tclvfs supports. The first kind is a particular mount point such as an archive 'foo.zip' or 'ftp://ftp.scriptics/com/pubpub vfs::zip::Mount pub/archive.zip pub/archive.zip % load a .dll from inside a .zip which sits on a remote ftp site. load pub/archive.zip/foo.dll



Moritz: How can I simply treat a normal local file as filesystem?What exactly do you mean by that? If the "normal local file" is a zip file, starkit or tar file, for example, mount it like one of the examples above. If it's a plain text file or some other format you will have to create a vfs driver for it.