Last active
December 15, 2015 08:09
-
-
Save alco/5229251 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Muchas Gracias!