diff options
author | Ben Elliston <bje@gnu.org> | 2018-12-10 11:39:50 +1100 |
---|---|---|
committer | Ben Elliston <bje@gnu.org> | 2018-12-10 11:39:50 +1100 |
commit | 8efa01a023d9168bb6cb8a1a4024b007e94e4114 (patch) | |
tree | 9ef4df7287e2fa960592847827d66166dd21b958 /lib | |
parent | 00e2a4272ba0a4dd037d362b9f6554a978627f5f (diff) | |
download | dejagnu-8efa01a023d9168bb6cb8a1a4024b007e94e4114.zip dejagnu-8efa01a023d9168bb6cb8a1a4024b007e94e4114.tar.gz dejagnu-8efa01a023d9168bb6cb8a1a4024b007e94e4114.tar.bz2 |
* lib/utils.exp (getdirs): Use glob -nocomplain rather than glob
and catching the "no files matched glob pattern" error
message. Catching the error message was the wrong thing to do
because the foreach loop then iterates over each word in the error
message as if they were matches.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/utils.exp | 53 |
1 files changed, 22 insertions, 31 deletions
diff --git a/lib/utils.exp b/lib/utils.exp index 57a6831..6acfa7c 100644 --- a/lib/utils.exp +++ b/lib/utils.exp @@ -44,44 +44,35 @@ proc getdirs { args } { set pattern "*" } verbose "Looking in $path for directories that match \"${pattern}\"" 3 - catch "glob $path/$pattern" tmp - if { $tmp ne "" } { - foreach i $tmp { - if {[file isdirectory $i]} { - switch -- "[file tail $i]" { - "testsuite" - - "config" - - "lib" - - ".git" - - ".svn" - - "CVS" - - "RCS" - - "SCCS" { - verbose "Ignoring directory [file tail $i]" 3 - continue - } - default { - if {[file readable $i]} { - verbose "Found directory [file tail $i]" 3 - lappend dirs $i - if { $alldirs } { - eval lappend dirs [getdirs -all $i $pattern] - } + set dirs [list] + foreach i [glob -nocomplain $path/$pattern] { + if {[file isdirectory $i]} { + switch -- "[file tail $i]" { + "testsuite" - + "config" - + "lib" - + ".git" - + ".svn" - + "CVS" - + "RCS" - + "SCCS" { + verbose "Ignoring directory [file tail $i]" 3 + continue + } + default { + if {[file readable $i]} { + verbose "Found directory [file tail $i]" 3 + lappend dirs $i + if { $alldirs } { + eval lappend dirs [getdirs -all $i $pattern] } } } } } - } else { - perror $tmp - return "" } - if {![info exists dirs]} { - return "" - } else { - return $dirs - } + return $dirs } |