Re: Correct ls/1 in c.erl

Björn Gustavsson <[email protected]>
Newsgroups gmane.comp.lang.erlang.patches
Message-ID <CA+yh78RW6Z=cLVvoxW9WSMsQ-6k3RmNiuB+yRjL2WRTRToj9_w@mail.gmail.com>
On Tue, May 14, 2013 at 11:27 AM, Anthony Ramine <[email protected]> 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

_______________________________________________
erlang-patches mailing list
[email protected]
http://erlang.org/mailman/listinfo/erlang-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.