return [list type directory mtime 0 size 0 mode 0777 ino -1 \
depth 0 name "" dev -1 uid -1 gid -1 nlink 1]
}
-
# get information on the type of this file
set ftpInfo [_findFtpInfo $fd $name]
if {$ftpInfo == ""} { error "Couldn't find file info" }
set mtime [ftp::ModTime $fd $name]
}
lappend res dev -1 uid -1 gid -1 nlink 1 depth 0 \
- atime $mtime ctime $mtime mtime $mtime mode 0777
+ atime $mtime ctime $mtime mtime $mtime mode 0777 \
+ size [ftp::FileSize $fd $name]
return $res
}
::vfs::log "findFtpInfo $fd $name"
set ftpList [ftp::List $fd [file dirname $name]]
foreach p $ftpList {
- foreach {pname perms} [_parseListLine $p] {}
+ foreach {pname other} [_parseListLine $p] {}
if {$pname == [file tail $name]} {
- return [list $perms]
+ return $other
}
}
return ""
}
-# Currently returns a list of name and permissions
+# Currently returns a list of name and a list of other
+# information. The other information is currently a
+# list of:
+# () permissions
+# () size
proc vfs::ftp::_parseListLine {line} {
# Check for filenames with spaces
if {[regexp {([^ ]|[^0-9] )+$} $line name]} {
}
regsub -all "\[ \t\]+" $line " " line
set items [split $line " "]
-
+
if {![info exists name]} {set name [lindex $items end]}
+ lappend other [lindex $items 0]
+ if {[string is integer [lindex $items 4]]} {
+ lappend other [lindex $items 4]
+ }
- set perms [lindex $items 0]
-
- return [list $name $perms]
+ return [list $name $other]
}
proc vfs::ftp::matchindirectory {fd path actualpath pattern type} {
proc access {db name mode} {
# This needs implementing better.
- ::mk4vfs::stat $db $name sb
+ if {$mode & 2} {
+ ::mk4vfs::stat $db $name
+ #error "read-only"
+ } else {
+ ::mk4vfs::stat $db $name
+ }
}
proc open {db file mode permissions} {
mk::file close $db
}
- proc stat {db path arr} {
- upvar 1 $arr sb
+ proc stat {db path {arr ""}} {
set sp [::file split $path]
set tail [lindex $sp end]
# Now check if final comp is a directory or a file
# CACHING is required - it can deliver a x15 speed-up!
- if { [string equal $tail "."] || [string equal $tail ":"] ||
- [string equal $tail ""] } {
+ if {[string equal $tail "."] || [string equal $tail ":"] \
+ || [string equal $tail ""]} {
set row $parent
} elseif { [info exists v::cache($db,$parent,$tail)] } {
}
}
}
+
+ if {![string length $arr]} {
+ # The caller doesn't need more detailed information.
+ return 1
+ }
+
set cur $view!$row
+ upvar 1 $arr sb
+
set sb(type) $type
set sb(view) $view
set sb(ino) $cur