# we match properly when given 'directory'
# specifications, since this is used for
# recursive globbing by Tcl.
-proc vfs::matchCorrectTypes {types filelist} {
+proc vfs::matchCorrectTypes {types filelist {inDir ""}} {
if {$types != 0} {
# Which types to return. We must do special
# handling of directories and files.
return [list]
}
set newres [list]
- if {$file} {
- foreach r $filelist {
- if {[::file isfile $r]} {
- lappend newres $r
+ if {[string length $inDir]} {
+ if {$file} {
+ foreach r $filelist {
+ if {[::file isfile [file join $inDir $r]]} {
+ lappend newres $r
+ }
+ }
+ } else {
+ foreach r $filelist {
+ #puts [file join $inDir $r]
+ if {[::file isdirectory [file join $inDir $r]]} {
+ lappend newres $r
+ }
}
}
} else {
- foreach r $filelist {
- if {[::file isdirectory $r]} {
- lappend newres $r
+ if {$file} {
+ foreach r $filelist {
+ if {[::file isfile $r]} {
+ lappend newres $r
+ }
+ }
+ } else {
+ foreach r $filelist {
+ if {[::file isdirectory $r]} {
+ lappend newres $r
+ }
}
}
}
proc vfs::zip::matchindirectory {zipfd path actualpath pattern type} {
puts stderr [list matchindirectory $path $actualpath $pattern $type]
set res [::zip::getdir $zipfd $path $pattern]
+ #puts stderr "got $res"
set newres [list]
- foreach p [::vfs::matchCorrectTypes $type $res] {
+ foreach p [::vfs::matchCorrectTypes $type $res $actualpath] {
lappend newres "$actualpath$p"
}
#puts "got $newres"