* examples/simpleExamples.tcl: a demo
* doc/vfslib.n: some documentation on the 'library' code.
+2002-02-17 Vince Darley <vincentdarley@sourceforge.net>
+ * generic/vfs.c: updated for TIP#72 application to cvs head.
+ The 'file stat' implementation now deals with files of size
+ greater than a 32 bit representation.
+
2001-10-29 Vince Darley <vincentdarley@sourceforge.net>
* win/makefile.vc: installation is better.
* library/vfsUrl.tcl: improved urltype mounting. The following
* virtual file system support, and therefore allows
* vfs's to be implemented in Tcl.
*
+ * Some of this file could be used as a basis for a hard-coded
+ * vfs implemented in C (e.g. a zipvfs).
+ *
* The code is thread-safe. Although under normal use only
* one interpreter will be used to add/remove mounts and volumes,
* it does cope with multiple interpreters in multiple threads.
static int
VfsStat(pathPtr, bufPtr)
Tcl_Obj *pathPtr; /* Path of file to stat (in current CP). */
- struct stat *bufPtr; /* Filled with results of stat call. */
+ Tcl_StatBuf *bufPtr; /* Filled with results of stat call. */
{
Tcl_Obj *mountCmd = NULL;
Tcl_SavedResult savedResult;
}
bufPtr->st_gid = (short)v;
} else if (!strcmp(fieldName,"size")) {
- long v;
- if (Tcl_GetLongFromObj(interp, val, &v) != TCL_OK) {
+ Tcl_WideInt v;
+ if (Tcl_GetWideIntFromObj(interp, val, &v) != TCL_OK) {
returnVal = TCL_ERROR;
break;
}
proc vfs::ftp::matchindirectory {fd path actualpath pattern type} {
::vfs::log "matchindirectory $path $pattern $type"
- set ftpList [ftp::List $fd $path]
- ::vfs::log "ftpList: $ftpList"
set res [list]
-
- foreach p $ftpList {
- foreach {name perms} [_parseListLine $p] {}
- if {[::vfs::matchDirectories $type]} {
+ if {![string length $pattern]} {
+ # matching a single file
+ set ftpInfo [_findFtpInfo $fd $path]
+ if {$ftpInfo != ""} {
+ # Now check if types match
+ set perms [lindex $ftpInfo 0]
if {[string index $perms 0] == "d"} {
- lappend res "$actualpath$name"
+ if {[::vfs::matchDirectories $type]} {
+ lappend res $actualpath
+ }
+ } else {
+ if {[::vfs::matchFiles $type]} {
+ lappend res $actualpath
+ }
}
}
- if {[::vfs::matchFiles $type]} {
- if {[string index $perms 0] != "d"} {
- lappend res "$actualpath$name"
+ } else {
+ # matching all files in the given directory
+ set ftpList [ftp::List $fd $path]
+ ::vfs::log "ftpList: $ftpList"
+
+ foreach p $ftpList {
+ foreach {name perms} [_parseListLine $p] {}
+ if {[::vfs::matchDirectories $type]} {
+ if {[string index $perms 0] == "d"} {
+ lappend res "$actualpath$name"
+ }
+ }
+ if {[::vfs::matchFiles $type]} {
+ if {[string index $perms 0] != "d"} {
+ lappend res "$actualpath$name"
+ }
}
+
}
-
}
return $res
proc vfs::mk4::matchindirectory {db path actualpath pattern type} {
#::vfs::log [list matchindirectory $path $actualpath $pattern $type]
- set res [::mk4vfs::getdir $db $path $pattern]
- #::vfs::log "got $res"
set newres [list]
+ if {![string length $pattern]} {
+ # check single file
+ set res [list $path]
+ } else {
+ set res [::mk4vfs::getdir $db $path $pattern]
+ }
+ #::vfs::log "got $res"
foreach p [::vfs::matchCorrectTypes $type $res $actualpath] {
lappend newres "$actualpath$p"
}