aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/filename.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stdlib/src/filename.erl')
-rw-r--r--lib/stdlib/src/filename.erl22
1 files changed, 10 insertions, 12 deletions
diff --git a/lib/stdlib/src/filename.erl b/lib/stdlib/src/filename.erl
index a6b42cc68c..0c50eb34e6 100644
--- a/lib/stdlib/src/filename.erl
+++ b/lib/stdlib/src/filename.erl
@@ -69,7 +69,7 @@ absname(Name) ->
-spec absname(Filename, Dir) -> file:filename() when
Filename :: file:name(),
- Dir :: file:filename().
+ Dir :: file:name().
absname(Name, AbsBase) when is_binary(Name), is_list(AbsBase) ->
absname(Name,filename_string_to_binary(AbsBase));
absname(Name, AbsBase) when is_list(Name), is_binary(AbsBase) ->
@@ -123,7 +123,7 @@ absname_vr([[X, $:]|Name], _, _AbsBase) ->
%% AbsBase must be absolute and Name must be relative.
-spec absname_join(Dir, Filename) -> file:filename() when
- Dir :: file:filename(),
+ Dir :: file:name(),
Filename :: file:name().
absname_join(AbsBase, Name) ->
join(AbsBase, flatten(Name)).
@@ -388,7 +388,7 @@ extension([], Result, _OsType) ->
%% Joins a list of filenames with directory separators.
-spec join(Components) -> file:filename() when
- Components :: [file:filename()].
+ Components :: [file:name()].
join([Name1, Name2|Rest]) ->
join([join(Name1, Name2)|Rest]);
join([Name]) when is_list(Name) ->
@@ -401,8 +401,8 @@ join([Name]) when is_atom(Name) ->
%% Joins two filenames with directory separators.
-spec join(Name1, Name2) -> file:filename() when
- Name1 :: file:filename(),
- Name2 :: file:filename().
+ Name1 :: file:name(),
+ Name2 :: file:name().
join(Name1, Name2) when is_list(Name1), is_list(Name2) ->
OsType = major_os_type(),
case pathtype(Name2) of
@@ -624,7 +624,7 @@ rootname2([Char|Rest], Ext, Result) when is_integer(Char) ->
-spec split(Filename) -> Components when
Filename :: file:name(),
- Components :: [file:filename()].
+ Components :: [file:name()].
split(Name) when is_binary(Name) ->
case os:type() of
{win32, _} -> win32_splitb(Name);
@@ -718,7 +718,7 @@ split([], Comp, Components, OsType) ->
%% name will be normalized as done by join/1.
-spec nativename(Path) -> file:filename() when
- Path :: file:filename().
+ Path :: file:name().
nativename(Name0) ->
Name = join([Name0]), %Normalize.
case os:type() of
@@ -878,7 +878,7 @@ filter_options(_Base, [], Result) ->
%% Gets the source file given path of object code and module name.
get_source_file(Obj, Mod, Rules) ->
- source_by_rules(dirname(Obj), packages:last(Mod), Rules).
+ source_by_rules(dirname(Obj), atom_to_list(Mod), Rules).
source_by_rules(Dir, Base, [{From, To}|Rest]) ->
case try_rule(Dir, Base, From, To) of
@@ -915,10 +915,8 @@ make_abs_path(BasePath, Path) ->
join(BasePath, Path).
major_os_type() ->
- case os:type() of
- {OsT, _} -> OsT;
- OsT -> OsT
- end.
+ {OsT, _} = os:type(),
+ OsT.
%% flatten(List)
%% Flatten a list, also accepting atoms.