changes to add another clause to the directory/file check

This commit is contained in:
Low Kian Seong 2014-05-14 22:42:59 +08:00
parent 6d742c0cae
commit cc7f6dd0df

View file

@ -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 ->
@ -127,9 +127,12 @@ type(Path) ->
case is_symlink(Path) of
true ->
symlink;
false ->
directory
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