tcl expert needed
Bjarne D Mathiesen
macintosh at mathiesen.info
Thu May 31 19:20:36 PDT 2012
Joshua Root wrote:
> On 2012-6-1 10:21 , Bjarne D Mathiesen wrote:
>> I've got the following piece of tcl script :
>>
>> +++ script start +++
>> proc filesys dirPath {
>> try {
>> foreach filePath [glob -directory ${dirPath} *] {
>> ui_msg "[file size ${filePath}] :: ${filePath}"
>> if { [file isdirectory ${filePath}] } {
>> filesys ${filePath}
>> }
>> }
>> } finally {
>> }
>> }
>>
>> filesys "${filespath}/install"
>> +++ script end +++
>
> The try command is not standard Tcl, it's defined in
> base/src/macports1.0/macports_util.tcl.
it's in the tcl we've got ... but a little different than the one
described on http://tmml.sourceforge.net/doc/tcl/try.html as there's no
/on error/
>
>> What I'm trying to do, is walk recursively through a file system and
>> make some action based upon wheher the /filePath/ is a dir or a normal
>> file. It works perfectly - untill it reaches an empty dir and I get this
>> error :
>>
>> Error: Unable to open port: no files matched glob pattern "*"
>
> Use glob -nocomplain if you don't want it to throw an error when nothing
> matches. See 'man n glob'.
!!! YES !!! this was exactly the information I was looking for :-D
I need to be better to read the manuals ;-)
>
>> What's bugging me is why the /try/ doesn't catch the error and ignores
>> it.
>
> You don't specify a catch block, so I guess it's probably assuming you
> want the equivalent of a blank one?
yes ... I wanted it to just continue when no files were present in a dir
--
Bjarne D Mathiesen
København N ; Danmark ; Europa
----------------------------------------------------------------------
denne besked er skrevet i et totalt M$-frit miljø
MacOS X 10.7.3 Lion ; 2.8GHz Intel Core i7 ; 16GB 1067MHz DDR3
More information about the macports-dev
mailing list