summaryrefslogtreecommitdiff
path: root/src/rebar_file_utils.erl
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2018-10-05 08:29:07 -0600
committerGitHub <noreply@github.com>2018-10-05 08:29:07 -0600
commitdec484643c233fda9c17d38c1854ba7f3f37547b (patch)
treecc3c83d55ca3c24000e52f4db8a4a0a5603fae2e /src/rebar_file_utils.erl
parent6ea0a600b4f560565ca963b69c86b9e9cb0ea0b8 (diff)
compiler behaviour (#1893)
* add compile type for dynamic project compilation * new rebar_compiler abstraction for running multiple compilers rebar_compiler is a new behaviour that a plugin can implement to be called on any ues of the compile provider to compile source files and keep track of their dependencies. * fix check that modules in .app modules list are from src_dirs * use project_type to find module for building projects * allow plugins to add project builders and compilers
Diffstat (limited to 'src/rebar_file_utils.erl')
-rw-r--r--src/rebar_file_utils.erl11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/rebar_file_utils.erl b/src/rebar_file_utils.erl
index 492d690..a51a557 100644
--- a/src/rebar_file_utils.erl
+++ b/src/rebar_file_utils.erl
@@ -43,7 +43,8 @@
path_from_ancestor/2,
canonical_path/1,
resolve_link/1,
- split_dirname/1]).
+ split_dirname/1,
+ ensure_dir/1]).
-include("rebar.hrl").
@@ -386,7 +387,7 @@ reset_dir(Path) ->
%% delete the directory if it exists
_ = ec_file:remove(Path, [recursive]),
%% recreate the directory
- filelib:ensure_dir(filename:join([Path, "dummy.beam"])).
+ ensure_dir(Path).
%% Linux touch but using erlang functions to work in bot *nix os and
@@ -440,6 +441,10 @@ resolve_link(Path) ->
split_dirname(Path) ->
{filename:dirname(Path), filename:basename(Path)}.
+-spec ensure_dir(filelib:dirname_all()) -> ok | {error, file:posix()}.
+ensure_dir(Path) ->
+ filelib:ensure_dir(filename:join(Path, "fake_file")).
+
%% ===================================================================
%% Internal functions
%% ===================================================================
@@ -505,7 +510,7 @@ cp_r_win32({true, SourceDir}, {false, DestDir}) ->
false ->
%% Specifying a target directory that doesn't currently exist.
%% So let's attempt to create this directory
- case filelib:ensure_dir(filename:join(DestDir, "dummy")) of
+ case ensure_dir(DestDir) of
ok ->
ok = xcopy_win32(SourceDir, DestDir);
{error, Reason} ->