瀏覽代碼

Export `normalized_relative_path/1` instead of `normalized_path/2`

pull/2247/head
Pablo Costas 5 年之前
父節點
當前提交
7ea897ac3f
共有 2 個檔案被更改,包括 8 行新增7 行删除
  1. +2
    -6
      src/rebar_dir.erl
  2. +6
    -1
      src/rebar_file_utils.erl

+ 2
- 6
src/rebar_dir.erl 查看文件

@ -249,8 +249,8 @@ extra_src_dirs(Opts, Default) ->
src_dirs(Type, Opts, Default) -> src_dirs(Type, Opts, Default) ->
lists:usort([ lists:usort([
case D0 of 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)]). end || D0 <- raw_src_dirs(Type,Opts,Default)]).
%% @private extracts the un-formatted src_dirs or extra_src_dirs %% @private extracts the un-formatted src_dirs or extra_src_dirs
@ -263,10 +263,6 @@ raw_src_dirs(Type, Opts, Default) ->
Dirs -> Dirs Dirs -> Dirs
end. 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 %% @doc returns all the source directories (`src_dirs' and
%% `extra_src_dirs'). %% `extra_src_dirs').
-spec all_src_dirs(rebar_dict()) -> list(file:filename_all()). -spec all_src_dirs(rebar_dict()) -> list(file:filename_all()).

+ 6
- 1
src/rebar_file_utils.erl 查看文件

@ -45,7 +45,7 @@
canonical_path/1, canonical_path/1,
absolute_path/1, absolute_path/1,
normalized_path/1, normalized_path/1,
normalized_path/2,
normalize_relative_path/1,
resolve_link/1, resolve_link/1,
split_dirname/1, split_dirname/1,
ensure_dir/1]). ensure_dir/1]).
@ -492,6 +492,11 @@ normalized_path([H|T], NormalizedPath) ->
_ -> normalized_path(T, [H|NormalizedPath]) _ -> normalized_path(T, [H|NormalizedPath])
end. 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 %% @doc returns canonical target of path if path is a link, otherwise returns path
-spec resolve_link(string()) -> string(). -spec resolve_link(string()) -> string().
resolve_link(Path) -> resolve_link(Path) ->

Loading…
取消
儲存