Skip to content

Instantly share code, notes, and snippets.

@alco
Last active December 15, 2015 08:09
Show Gist options
  • Save alco/5229251 to your computer and use it in GitHub Desktop.
Save alco/5229251 to your computer and use it in GitHub Desktop.
@doc """
Get list of files and directories in `dir`.
"""
def listdir(dir) do
F.list_dir(dir)
end
@doc """
Get list of files and directories in `dir`.
Raises File.Error in case of an error.
"""
def listdir!(dir) do
case F.list_dir(dir) do
{ :ok, files } -> files
{ :error, reason } ->
raise File.Error, reason: reason, action: "list directory", path: :unicode.characters_to_binary(dir)
end
end
@n1rvana
Copy link

n1rvana commented Mar 23, 2013

Muchas Gracias!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment