diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2016-08-25 22:21:07 -0400 |
---|---|---|
committer | Fred Hebert <mononcqc@ferd.ca> | 2016-08-25 22:21:07 -0400 |
commit | 4f32da2ab7e0a7cf2f2e2de911c0c8ea0a7d8848 (patch) | |
tree | 232cacdc61d742b0e6443fb54f1ccbef3ae5f500 /src | |
parent | b4e78f38a5cbd6d73f5481d2d7fa8d717688f576 (diff) |
Equivalent trim_all in bin split for <17.x
The trim_all option used in binary:split/3 is not supported in 17.x.
This patch makes an equivalent operation by eliminating empty split
fragments. From the docs:
trim
Removes trailing empty parts of the result (as does trim in
re:split/3.
trim_all
Removes all empty parts of the result.
The new expression is therefore equivalent to the old one, but with the
added benefit of compatibility.
Fixes #1275
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_app_utils.erl | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/rebar_app_utils.erl b/src/rebar_app_utils.erl index d256cac..50c6314 100644 --- a/src/rebar_app_utils.erl +++ b/src/rebar_app_utils.erl @@ -182,7 +182,7 @@ update_source(AppInfo, {pkg, PkgName, PkgVsn, Hash}, State) -> undefined -> get_package(PkgName, "0", State); <<"~>", Vsn/binary>> -> - [Vsn1] = binary:split(Vsn, [<<" ">>], [trim_all, global]), + [Vsn1] = [X || X <- binary:split(Vsn, [<<" ">>], [global]), X =/= <<>>], get_package(PkgName, Vsn1, State); _ -> {PkgName, PkgVsn} |