[erlang-patches] Correct ls/1 in c.erl

Björn Gustavsson <>
Tue May 14 12:13:23 CEST 2013


On Tue, May 14, 2013 at 11:27 AM, Anthony Ramine <> wrote:

> Hello Björn,
>
> The whole point of his patch is to make c:ls/1 able to list files as well
> as directories, like what ls(1) does on the command line, so I don't think
> he should use filelib:is_regular/1 here.
>
>
Note that filelib:is_file/1 and ls_file/1 is only called if file:list_dir/1
failed.

The first clause of ls_file/1 will be taken if File is either a
regular file or a directory that cannot be listed (e.g. because
of insufficient permissions).

The second clause will only be taken if File is a device or some
other sort of special file.

I don't know for sure Bengt's intention, but to me it makes
more sense if the first clause would only be taken if File is
a regular File.

This is probably a moot point if the patch is rewritten the
way I suggested.

/Bjorn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20130514/4c49459b/attachment.html>


More information about the erlang-patches mailing list