1. Re: walk_dir issue
- Posted by "Juergen Luethje" <j.lue at gmx.de> Nov 24, 2004
- 469 views
- Last edited Nov 25, 2004
Greg Haberek wrote: >> Hi all, >> >> with Eu 2.5 alpha there is still this issue, that Derek had reported >> regarding Eu 2.4. >> >> The following code is slightly modified after 'lib_u_z.htm': >> }}} <eucode> >> include file.e >> >> function look_at (sequence path_name, sequence entry) >> printf(1, "%s\\%s: %d\n", {path_name, entry[D_NAME], entry[D_SIZE]}) >> return 0 -- keep going >> end function >> >> ? walk_dir("C:\\*.txt", routine_id("look_at"), 0) >> </eucode> {{{ >> >> You can see the effect that I mean only, if there actually is at least >> 1 .TXT file in directory C:\\. On my system it prints: >> -------------------------------- >> C:\*.txt\BOOTLOG.TXT: 59462 >> C:\*.txt\SETUPLOG.TXT: 89512 >> 0 >> -------------------------------- >> Rob, is this actually the way you want walk_dir() to work? >> >> Shouldn't it be >> -------------------------------- >> C:\BOOTLOG.TXT: 59462 >> C:\SETUPLOG.TXT: 89512 >> 0 >> -------------------------------- >> instead? >> >> Regards, >> Juergen > > Its my understanding that walk_dir() uses whatever directory you feed > it, without determining the *actual* directory. And since dir() can > accept wildcards, things work. Why not just do this: > > }}} <eucode> > include file.e > include wildcard.e > > function look_at (sequence path_name, sequence entry) > if wildcard_match( "*.txt", lower(entry[D_NAME]) ) then > printf(1, "%s\\%s: %d\n", {path_name, entry[D_NAME], entry[D_SIZE]}) > end if > return 0 -- keep going > end function > > ? walk_dir("C:\\", routine_id("look_at"), 0) > </eucode> {{{ That was not my question. My point was, that when we do e.g.
? walk_dir("C:\\*.txt", routine_id("look_at"), 0)
-- as I wrote above -- then something happens, that Derek and I consider a bug. Regards, Juergen