summaryrefslogtreecommitdiff
path: root/src/rebar_utils.erl
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2015-11-17 10:31:05 -0600
committerTristan Sloughter <t@crashfast.com>2015-12-19 10:42:30 -0600
commitc4c7ca42447e0bbe3b50347d064ce51fb5c4eff7 (patch)
treeffe0c26faf36bec8838c388a4e355d46cb842a66 /src/rebar_utils.erl
parentddc64cd66b2d6e4e2315ee281b9eabb8bc2e8868 (diff)
support temporary cdn change with HEX_CDN os var
Diffstat (limited to 'src/rebar_utils.erl')
-rw-r--r--src/rebar_utils.erl10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl
index fb651c3..746c57a 100644
--- a/src/rebar_utils.erl
+++ b/src/rebar_utils.erl
@@ -61,6 +61,7 @@
tup_find/2,
line_count/1,
set_httpc_options/0,
+ url_append_path/2,
escape_chars/1,
escape_double_quotes/1,
escape_double_quotes_weak/1,
@@ -798,6 +799,15 @@ set_httpc_options(Scheme, Proxy) ->
{ok, {_, _, Host, Port, _, _}} = http_uri:parse(Proxy),
httpc:set_options([{Scheme, {{Host, Port}, []}}], rebar).
+url_append_path(Url, ExtraPath) ->
+ case http_uri:parse(Url) of
+ {ok, {Scheme, UserInfo, Host, Port, Path, Query}} ->
+ {ok, lists:append([atom_to_list(Scheme), "://", UserInfo, Host, ":", integer_to_list(Port),
+ filename:join(Path, ExtraPath), "?", Query])};
+ _ ->
+ error
+ end.
+
%% escape\ as\ a\ shell\?
escape_chars(Str) when is_atom(Str) ->
escape_chars(atom_to_list(Str));