
  -spec list_dir(Dir) -> {ok, Filenames} | {error, Reason}
                    when
                        Dir :: name_all(),
                        Filenames :: [filename()],
                        Reason ::
                            posix() |
                            badarg |
                            {no_translation,
                             Filename :: unicode:latin1_binary()}.

  Lists all files in a directory, except files with raw filenames.
  Returns {ok, Filenames} if successful, otherwise {error,
  Reason}. Filenames is a list of the names of all the files in
  the directory. The names are not sorted.

  Typical error reasons:

  eacces:
    Missing search or write permissions for Dir or one of its
    parent directories.

  enoent:
    The directory does not exist.

  {no_translation, Filename}:
    Filename is a binary() with characters coded in ISO Latin-1
    and the VM was started with parameter +fnue.
