Re: Correct ls/1 in c.erl
Björn Gustavsson <[email protected]>
| Newsgroups | gmane.comp.lang.erlang.patches |
|---|---|
| Message-ID | <CA+yh78S6hrAqCdwjLgXYrAM44D5yzr=fNNrBFeJuZj3EW0-ajw@mail.gmail.com> |
On Mon, May 20, 2013 at 10:49 AM, Bengt Kleberg <[email protected]>wrote: > I will update the code and test suite according to you suggestions. > > The failure to print /dev/null is due to filelib:is_file/1 not thinking > of it as a file. I will change to another method. > It seems to me that the simplest way would be like this: ls(Dir) -> case file:list_dir(Dir) of {ok, Entries} -> ls_print(sort(Entries)); {error, enotdir} -> ls_print([Dir]); {error, Error} -> format(file:format_error(Error)) end. (and deleting the ls_file/2 function.) Do you seen any problem with that method? > -- Björn Gustavsson, Erlang/OTP, Ericsson AB _______________________________________________ erlang-patches mailing list [email protected] http://erlang.org/mailman/listinfo/erlang-patches