Re: walk_dir issue
- Posted by Matt Lewis <matthewwalkerlewis at yahoo.com> Oct 19, 2004
- 539 views
Derek Parnell wrote: > > Brian Broker wrote: > > > > Derek Parnell wrote: > > > > > > I'm not sure if this is a bug or design feature but if you pass > > > a path with wildcards to walk_dir, the routine_id that it calls > > > receives a Path parameter with the wildcard specification included. > > > > > > For example: > > > > > > res = walk_dir("C:\\temp\\test.*", routine_id("dirfunc"), 1) > > > > > > Then the routine 'dirfunc' gets "C:\temp\test.*" in the path name > > > parameter. I was expecting it to get "C:\temp" instead. > > > > > > > Actually, the docs state "This routine will "walk" through a directory > > with path name given by st." It expects a path name and doesn't say > > anything about supporting wildcard searches. > > I misunderstood. I thought a path was a set of directories that form > a hierarchy and that specifies the location of a file. Thus the file > specification "c:\temp\test.*" gives us the path of "c:\temp". > My mistake obviously. > > However, using your understanding instead, it must be a bug, because walk_dir > calls my user routine for each file that matches "test.*" in the > path (directory) "c:\temp". If the first parameter is supposed to be a > directory specification then I would expect that the user-defined routine > would not be called at all because no such directory as "c:\temp\test.*" > exists. I think that 'path' is somewhat ambiguous, in that a path can be a file or a directory. If you take a look at file.e, you'll see that (unless you change my_dir) it calls dir() on your path, so wildcards will be used on Win32 and DOS. It's possible to have a directory named "c:\temp\test.123\", so I think that the current behavior is correct. > > I don't think putting > > wildcard specs in your PATH environment varible works either (but I > > haven't bothered checking). > > And there is a point to that comment? Are you trying to insinuate that > I'm too stupid to understand the documentation. Well it looks like you > may very well be correct. I am now all embarrassed to have troubled > your pretty little head with my tribulations. A thousand pardons sir. Sheesh. Bad day at work? Matt Lewis