diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2016-01-17 06:16:42 -0500 |
---|---|---|
committer | Fred Hebert <mononcqc@ferd.ca> | 2016-01-17 06:16:42 -0500 |
commit | c8e0b1c5ce1b434850d34e50945f724c25e7df1b (patch) | |
tree | d25a905c9a6b8ec8009209573a01d7d485f7142c /src | |
parent | ec7245b454a43205eebc51728672d7a940434e58 (diff) | |
parent | 4e0de56b90b318e580884daf1d8f56ab3944b914 (diff) |
Merge pull request #1017 from talentdeficit/runtime_version_check
check at runtime instead of compile time for `file:list_dir_all/1`
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_utils.erl | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl index 746c57a..07bf789 100644 --- a/src/rebar_utils.erl +++ b/src/rebar_utils.erl @@ -828,8 +828,11 @@ info_useless(Old, New) -> not lists:member(Name, New)], ok. --ifdef(no_list_dir_all). -list_dir(Dir) -> file:list_dir(Dir). --else. -list_dir(Dir) -> file:list_dir_all(Dir). --endif. +list_dir(Dir) -> + %% `list_dir_all` returns raw files which are unsupported + %% prior to R16 so just fall back to `list_dir` if running + %% on an earlier vm + case erlang:function_exported(file, list_dir_all, 1) of + true -> file:list_dir_all(Dir); + false -> file:list_dir(Dir) + end. |