title: Erlang generate error on file:write_file(Filename, Data, [append])
body: <p>this code generate Error on file:write_file(Filename, Data, [append]),</p>
  
  <p>{{badmatch,{error,enoent}},[{t,save,2,[{file,"1.erl"},{line,38}]}]}</p>
  
  <pre><code>case file:read_file_info(Filename) of
      {error, Reason} -&gt;
        {ok, IoDevice}=file:open(Filename, [write, binary]),
        file:write_file(Filename, Data, [append]),  % line 38
        file:close(Filename),
        ok;
      {ok, FileInfo} -&gt; ok
    end.
  </code></pre>
  
  <p>that's wrong?</p>