Re: Correct ls/1 in c.erl

Björn Gustavsson <[email protected]>
Newsgroups gmane.comp.lang.erlang.patches
Message-ID <CA+yh78QFjuar3-pzFJ0HWBEUu65jy01iaX0hA61HSXdzEkL9Fg@mail.gmail.com>
On Mon, May 20, 2013 at 1:45 PM, Bengt Kleberg
<[email protected]>wrote:

> 6> file:list_dir("nosuchfile").
> {error,enotdir}
>
> I think to use file:read_link_info/1 to establish the existence of the
> file/directory.
>
> Why?

If file:list_dir(Name) returns {error,enotdir}, it means that
there exists a file named Name (but it is not a directory).

If no such file exists, the return value will be {error,enoent}.

In what situation would it be useful to call
file:read_link_info/1?

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

_______________________________________________
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.