diff options
Diffstat (limited to 'lib/stdlib/src/filename.erl')
-rw-r--r-- | lib/stdlib/src/filename.erl | 40 |
1 files changed, 3 insertions, 37 deletions
diff --git a/lib/stdlib/src/filename.erl b/lib/stdlib/src/filename.erl index 68b3f3200d..8bf4e97b9f 100644 --- a/lib/stdlib/src/filename.erl +++ b/lib/stdlib/src/filename.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2021. All Rights Reserved. +%% Copyright Ericsson AB 1997-2022. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -20,7 +20,7 @@ -module(filename). -removed([{find_src,'_',"use filelib:find_source/1,3 instead"}]). --deprecated([{safe_relative_path,1,"use filelib:safe_relative_path/2 instead"}]). +-removed([{safe_relative_path,1,"use filelib:safe_relative_path/2 instead"}]). %% Purpose: Provides generic manipulation of filenames. %% @@ -69,8 +69,7 @@ -export([absname/1, absname/2, absname_join/2, basename/1, basename/2, dirname/1, extension/1, join/1, join/2, pathtype/1, - rootname/1, rootname/2, split/1, flatten/1, nativename/1, - safe_relative_path/1]). + rootname/1, rootname/2, split/1, flatten/1, nativename/1]). -export([basedir/2, basedir/3]). -export([validate/1]). @@ -816,39 +815,6 @@ separators() -> _ -> {false, false} end. --spec safe_relative_path(Filename) -> 'unsafe' | SafeFilename when - Filename :: file:name_all(), - SafeFilename :: file:name_all(). - -safe_relative_path(Path) -> - case pathtype(Path) of - relative -> - Cs0 = split(Path), - safe_relative_path_1(Cs0, []); - _ -> - unsafe - end. - -safe_relative_path_1(["."|T], Acc) -> - safe_relative_path_1(T, Acc); -safe_relative_path_1([<<".">>|T], Acc) -> - safe_relative_path_1(T, Acc); -safe_relative_path_1([".."|T], Acc) -> - climb(T, Acc); -safe_relative_path_1([<<"..">>|T], Acc) -> - climb(T, Acc); -safe_relative_path_1([H|T], Acc) -> - safe_relative_path_1(T, [H|Acc]); -safe_relative_path_1([], []) -> - []; -safe_relative_path_1([], Acc) -> - join(lists:reverse(Acc)). - -climb(_, []) -> - unsafe; -climb(T, [_|Acc]) -> - safe_relative_path_1(T, Acc). - major_os_type() -> {OsT, _} = os:type(), OsT. |