diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar.app.src | 1 | ||||
-rw-r--r-- | src/rebar_packages.erl | 7 | ||||
-rw-r--r-- | src/rebar_prv_local_install.erl | 11 | ||||
-rw-r--r-- | src/rebar_string.erl | 2 |
4 files changed, 18 insertions, 3 deletions
diff --git a/src/rebar.app.src b/src/rebar.app.src index 43ad620..c96f65c 100644 --- a/src/rebar.app.src +++ b/src/rebar.app.src @@ -8,6 +8,7 @@ {registered, []}, {applications, [kernel, stdlib, + hipe, sasl, compiler, crypto, diff --git a/src/rebar_packages.erl b/src/rebar_packages.erl index 50d4025..8cebeca 100644 --- a/src/rebar_packages.erl +++ b/src/rebar_packages.erl @@ -97,7 +97,12 @@ registry_dir(State) -> case rebar_state:get(State, rebar_packages_cdn, ?DEFAULT_CDN) of ?DEFAULT_CDN -> RegistryDir = filename:join([CacheDir, "hex", "default"]), - ok = filelib:ensure_dir(filename:join(RegistryDir, "placeholder")), + case filelib:ensure_dir(filename:join(RegistryDir, "placeholder")) of + ok -> ok; + {error, Posix} when Posix == eaccess; Posix == enoent -> + ?ABORT("Could not write to ~p. Please ensure the path is writeable.", + [RegistryDir]) + end, {ok, RegistryDir}; CDN -> case rebar_utils:url_append_path(CDN, ?REMOTE_PACKAGE_DIR) of diff --git a/src/rebar_prv_local_install.erl b/src/rebar_prv_local_install.erl index 282c548..bb019c4 100644 --- a/src/rebar_prv_local_install.erl +++ b/src/rebar_prv_local_install.erl @@ -12,6 +12,7 @@ -export([extract_escript/2]). -include("rebar.hrl"). +-include_lib("providers/include/providers.hrl"). -include_lib("kernel/include/file.hrl"). -define(PROVIDER, install). @@ -54,6 +55,9 @@ do(State) -> end. -spec format_error(any()) -> iolist(). +format_error({non_writeable, Dir}) -> + io_lib:format("Could not write to ~p. Please ensure the path is writeable.", + [Dir]); format_error(Reason) -> io_lib:format("~p", [Reason]). @@ -71,7 +75,12 @@ extract_escript(State, ScriptPath) -> %% And add a rebar3 bin script to ~/.cache/rebar3/bin Opts = rebar_state:opts(State), OutputDir = filename:join(rebar_dir:global_cache_dir(Opts), "lib"), - filelib:ensure_dir(filename:join(OutputDir, "empty")), + case filelib:ensure_dir(filename:join(OutputDir, "empty")) of + ok -> + ok; + {error, Posix} when Posix == eaccess; Posix == enoent -> + throw(?PRV_ERROR({non_writeable, OutputDir})) + end, ?INFO("Extracting rebar3 libs to ~ts...", [OutputDir]), zip:extract(Archive, [{cwd, OutputDir}]), diff --git a/src/rebar_string.erl b/src/rebar_string.erl index c1858f9..47cb15c 100644 --- a/src/rebar_string.erl +++ b/src/rebar_string.erl @@ -11,7 +11,7 @@ %% used. Instead we just adopt join/2 locally and hope it works %% for most unicode use cases anyway. join([], Sep) when is_list(Sep) -> - []; + []; join([H|T], Sep) -> H ++ lists:append([Sep ++ X || X <- T]). |