aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2014-08-08 11:52:23 +1000
committerSteve Bennett <steveb@workware.net.au>2014-08-08 11:59:27 +1000
commit0c24afc040fcdcdc51513ea946a1cf4b36987a09 (patch)
treeee1e205ece2082ff08c6b6344d5e10a0f4490b47
parent0b60827ba7bbbefd991a99dfcae4973d51387f82 (diff)
downloadjimtcl-0c24afc040fcdcdc51513ea946a1cf4b36987a09.zip
jimtcl-0c24afc040fcdcdc51513ea946a1cf4b36987a09.tar.gz
jimtcl-0c24afc040fcdcdc51513ea946a1cf4b36987a09.tar.bz2
glob: work when intermidiate dirs are not readable
If /a/b/c exists, but directory 'a' has 'x' but not 'r' permissions, we should still be able to glob /a/b/* Signed-off-by: Steve Bennett <steveb@workware.net.au>
-rw-r--r--glob.tcl5
1 files changed, 5 insertions, 0 deletions
diff --git a/glob.tcl b/glob.tcl
index 6b1ad39..ea27fde 100644
--- a/glob.tcl
+++ b/glob.tcl
@@ -9,6 +9,11 @@ package require readdir
# Return a list of all entries in $dir that match the pattern.
proc glob.globdir {dir pattern} {
+ if {[file exists $dir/$pattern]} {
+ # Simple case
+ return $pattern
+ }
+
set result {}
set files [readdir $dir]
lappend files . ..