[erlang-patches] Correct ls/1 in c.erl
Bengt Kleberg
bengt.kleberg@REDACTED
Mon May 20 16:22:32 CEST 2013
The filelib:is_dir/is_file/is_regular functions confuse me. I am unsure
what they will return for directories, files, links, special files,
none-existing files and the combination of read/no-read access for
these.
file:read_link_info/1 is more predictable.
bengt
On Mon, 2013-05-20 at 15:59 +0200, Björn Gustavsson wrote:
> On Mon, May 20, 2013 at 1:45 PM, Bengt Kleberg
> <bengt.kleberg@REDACTED> 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
More information about the erlang-patches
mailing list