From 7ea897ac3f09d51eee2b83a25c4725de6032b907 Mon Sep 17 00:00:00 2001 From: Pablo Costas Date: Fri, 13 Mar 2020 14:39:23 +0100 Subject: [PATCH] Export `normalized_relative_path/1` instead of `normalized_path/2` --- src/rebar_dir.erl | 8 ++------ src/rebar_file_utils.erl | 7 ++++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/rebar_dir.erl b/src/rebar_dir.erl index 3e377966..9e2a540c 100644 --- a/src/rebar_dir.erl +++ b/src/rebar_dir.erl @@ -249,8 +249,8 @@ extra_src_dirs(Opts, Default) -> src_dirs(Type, Opts, Default) -> lists:usort([ case D0 of - {D,_} -> normalize_relative_path(D); - _ -> normalize_relative_path(D0) + {D,_} -> rebar_file_utils:normalize_relative_path(D); + _ -> rebar_file_utils:normalize_relative_path(D0) end || D0 <- raw_src_dirs(Type,Opts,Default)]). %% @private extracts the un-formatted src_dirs or extra_src_dirs @@ -263,10 +263,6 @@ raw_src_dirs(Type, Opts, Default) -> Dirs -> Dirs end. -%% @private normalizes relative paths so that ./a/b/c/ => a/b/c -normalize_relative_path(Path) -> - rebar_file_utils:normalized_path(filename:split(Path), []). - %% @doc returns all the source directories (`src_dirs' and %% `extra_src_dirs'). -spec all_src_dirs(rebar_dict()) -> list(file:filename_all()). diff --git a/src/rebar_file_utils.erl b/src/rebar_file_utils.erl index 5dc8aebc..18ab8522 100644 --- a/src/rebar_file_utils.erl +++ b/src/rebar_file_utils.erl @@ -45,7 +45,7 @@ canonical_path/1, absolute_path/1, normalized_path/1, - normalized_path/2, + normalize_relative_path/1, resolve_link/1, split_dirname/1, ensure_dir/1]). @@ -492,6 +492,11 @@ normalized_path([H|T], NormalizedPath) -> _ -> normalized_path(T, [H|NormalizedPath]) end. +%% @doc normalizes relative paths so that ./a/b/c/ => a/b/c +-spec normalize_relative_path(string()) -> file:filename(). +normalize_relative_path(Path) -> + normalized_path(filename:split(Path), []). + %% @doc returns canonical target of path if path is a link, otherwise returns path -spec resolve_link(string()) -> string(). resolve_link(Path) ->