From cc7f6dd0dfaeaa00b92d25ac5ffe2cde06987249 Mon Sep 17 00:00:00 2001 From: Low Kian Seong Date: Wed, 14 May 2014 22:42:59 +0800 Subject: [PATCH] changes to add another clause to the directory/file check --- src/ec_file.erl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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