diff --git a/src/ec_file.erl b/src/ec_file.erl index cda2ca1..46f14e9 100644 --- a/src/ec_file.erl +++ b/src/ec_file.erl @@ -118,7 +118,7 @@ is_symlink(Path) -> false end. %% @doc returns the type of the file. --spec type(file:name()) -> file | symlink | directory. +-spec type(file:name()) -> file | symlink | directory | undefined. type(Path) -> case filelib:is_regular(Path) of true -> @@ -126,10 +126,13 @@ type(Path) -> false -> case is_symlink(Path) of true -> - symlink; - false -> - directory + symlink; + false -> case filelib:is_dir(Path) of + true -> directory; + false -> undefined + end end + end. %% @doc gets the real path of a directory. This is mostly useful for %% resolving symlinks. Be aware that this temporarily changes the