瀏覽代碼

Merge pull request #1637 from ferd/re-fix-src-dir-specs

Corrects a fix to src_dir values
pull/1641/head
Fred Hebert 7 年之前
committed by GitHub
父節點
當前提交
4352614e9b
共有 2 個檔案被更改,包括 6 行新增3 行删除
  1. +3
    -1
      src/rebar_dir.erl
  2. +3
    -2
      test/rebar_dir_SUITE.erl

+ 3
- 1
src/rebar_dir.erl 查看文件

@ -197,8 +197,10 @@ make_normalized_path([], NormalizedPath) ->
filename:join(lists:reverse(NormalizedPath));
make_normalized_path([H|T], NormalizedPath) ->
case H of
"." when NormalizedPath == [], T == [] -> make_normalized_path(T, ["."]);
"." -> make_normalized_path(T, NormalizedPath);
".." -> make_normalized_path(T, tl(NormalizedPath));
".." when NormalizedPath == [] -> make_normalized_path(T, [".."]);
".." when hd(NormalizedPath) =/= ".." -> make_normalized_path(T, tl(NormalizedPath));
_ -> make_normalized_path(T, [H|NormalizedPath])
end.

+ 3
- 2
test/rebar_dir_SUITE.erl 查看文件

@ -68,10 +68,11 @@ default_all_src_dirs(Config) ->
["src", "test"] = rebar_dir:all_src_dirs(rebar_state:opts(State), ["src"], ["test"]).
src_dirs(Config) ->
RebarConfig = [{erl_opts, [{src_dirs, ["foo", "./bar", "bar", "bar/", "./bar/", "baz"]}]}],
RebarConfig = [{erl_opts, [{src_dirs, ["foo", "./bar", "bar", "bar/", "./bar/", "baz",
"./", ".", "../", "..", "./../", "../.", ".././../"]}]}],
{ok, State} = rebar_test_utils:run_and_check(Config, RebarConfig, ["compile"], return),
["bar", "baz", "foo"] = rebar_dir:src_dirs(rebar_state:opts(State)).
[".", "..", "../..", "bar", "baz", "foo"] = rebar_dir:src_dirs(rebar_state:opts(State)).
src_dirs_with_opts(Config) ->
RebarConfig = [{erl_opts, [{src_dirs, ["foo", "bar", "baz"]},

Loading…
取消
儲存