changes to add another clause to the directory/file check
This commit is contained in:
parent
6d742c0cae
commit
cc7f6dd0df
1 changed files with 7 additions and 4 deletions
|
@ -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 ->
|
||||||
|
@ -127,9 +127,12 @@ type(Path) ->
|
||||||
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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue