File lstat implementation.

This is a straightforward cut and paste implementation of File.lstat and File.lstat! based on the File.stat implementation. It more or less implements the same functionality, but just uses the underlying erlang call
:file.read_link_info, rather than :file.read_file_info. 

- Booker C. Bense
For what it's worth, stat and stat! are not the only methods to use this
duplicate call pattern.

Every foo and foo! method I looked at does exactly the same.

- Booker C. Bense

On Fri, Oct 10, 2014 at 12:31 PM, Paulo Almeida <notifications@github.com>
wrote:

> In lib/elixir/lib/file.ex:
>
> > +  def lstat(path, opts \\ []) do
> > +    case F.read_link_info(IO.chardata_to_string(path), opts) do
> > +      {:ok, fileinfo} ->
> > +        {:ok, File.Stat.from_record(fileinfo)}
> > +      error ->
> > +        error
> > +    end
> > +  end
> > +
> > +  @doc """
> > +  Same as `lstat/2` but returns the `File.Stat` directly and
> > +  throws `File.Error` if an error is returned.
> > +  """
> > +  @spec lstat!(Path.t, stat_options) :: File.Stat.t | no_return
> > +  def lstat!(path, opts \\ []) do
> > +    path = IO.chardata_to_string(path)
>
> IO.chardata_to_string ends up being called twice. Is this necessary?
>
> (I see it's the same with stat and stat!)
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/elixir-lang/elixir/pull/2814/files#r18726043>.
>