Re: walk_dir issue

new topic     » topic index » view thread      » older message » newer message

Juergen Luethje wrote:
> 
> Robert Craig wrote:
> 
> > Juergen Luethje wrote:
> >> That was not my question. My point was, that when we do e.g.
> >> }}}
<eucode>
> >> ? walk_dir("C:\\*.txt", routine_id("look_at"), 0)
> >> </eucode>
{{{

> >>
> >> -- as I wrote above -- then something happens, that Derek and I
> >> consider a bug.
> >
> > I'm not sure why this is a bug.
> > You are supposed to specify a single directory for walk_dir()
> > to walk. You are instead specifying a bunch of txt files.
> > How can you complain about what happens next? Do you
> > want walk_dir() to analyse the path you give it, and spit out
> > an error message?
> 
> It depends on what you actually want walk_dir() to do.
> 
> a) According to the current documentation, the first parameter should be
>    a path name. At least on DOS and Windows, something that contains a
>    wildcard is not a valid path name.
>    Yes, if the first parameter actually is supposed to be a path name,
>    then I would expect that the user-defined routine would not be called
>    at all because no such directory as "C:\\*.txt" exists, and that
>    walk_dir() spits out an error message.
> 
> b) On the other hand, if it is intended that the first parameter of
>    walk_dir() may contain wildcards, then the documentation should be
>    changed accordingly. And the walk_dir() function must be changed, so
>    that -- regarding my previous example -- onyly "C:" is given to the
>    user-defined function as the path name, rather than "C:\\*.txt",
>    because "C:\\*.txt" is not a path name.

I definitely intended and documented it as (a).

The fact that walk_dir doesn't immediately crash and burn
when given wildcards, is just a fluke, based on the
fact that dir() accepts wildcards, which is also a fluke
(now documented). I didn't even know myself that 
Euphoria's dir() worked with wildcards, until a user 
pointed it out to me. By the way, dir() does
not work with wildcards on Linux/FreeBSD. 

To keep everyone happy, I'll add "the directory path must not 
contain wildcards" to the docs. Sort of like "This machine 
converts oranges into orange juice. Do not insert watermelons".  smile

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu