tcl expert needed

Bjarne D Mathiesen macintosh at mathiesen.info
Thu May 31 17:21:58 PDT 2012


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 +++

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 "*"

What's bugging me is why the /try/ doesn't catch the error and ignores
it. I've tried moving the /[glob ...]/ outside the /foreach/ and create
a list that I then pass into the /foreach/, but that doesn't work either.

Do I really have to have a dummy file in all of my dirs ??

:-) Happy Hacking :-)
-- 
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-users mailing list