question about intended function of filelib:wildcard/2

Bjorn Gustavsson <>
Tue Apr 19 11:58:15 CEST 2005


I have now written the missing test suite and corrected the bug.

I have also corrected the minor bug that 

        filelib:wildcard("/not/a/wildcard/pattern")

would not check that "/not/a/wildcard/pattern" really existed; not it will
check and return an empty list if the file does not exist.

I have also changed the exception that is thrown when the pattern is
invalid, such as in

        filelib:wildcard("{a,")

It used to be exit(missing_delimiter); but is now
erlang:error({badpattern,missing_delimiter}).

The correction will be in included in OTP R10-5.

/Bjorn

Bengt Kleberg <> writes:

> greetings,
> 
> this is what the manual says:
> 
>         wildcard(Wildcard, Cwd) -> list()
> 
>                Types  Wildcard = filename() | dirname()
>                       Cwd = dirname()
> 
>                The wildcard/2  function  works  like  wildcard/1,
> except  that
>                instead of the actual working dirctory, Cwd will be used.
> 
> 
> i thought this would mean that the following 2 calls would give me the
> same result:
> 
>   filelib:wildcard("/home/eleberg/*").
>   filelib:wildcard("*", "/home/eleberg").
> 
> 
> on my system they return very different lists.
> 
> could somebody please explain if they should be different, and how
> wildcard/2 is supposed to be used.
> 
> or, what i am doing wrong.
> 
> 
> bengt
> 

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list