Merge pull request #63 from lowks/master

changes to add another clause to the directory/file check
This commit is contained in:
Jordan Wilberding 2014-05-15 09:34:28 +02:00
commit 364726c166

View file

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