summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorViacheslav Kovalev <kovyl2404@gmail.com>2015-06-03 13:08:46 +0300
committerDaniel Widgren <daniel.widgren@gmail.com>2015-06-26 09:20:28 +0200
commitf7bd6ca8ac7a125fbaf21100e6a7fd4e6511fd0c (patch)
tree9c1e69ad4f540f36bdadb9736743eb1723a7a286 /src
parente3d32b10cc074f3f76973ffad7038b8786b9b951 (diff)
Fix common test run duplication on windows
Diffstat (limited to 'src')
-rw-r--r--src/rebar_agent.erl6
-rw-r--r--src/rebar_dir.erl6
-rw-r--r--src/rebar_git_resource.erl2
3 files changed, 9 insertions, 5 deletions
diff --git a/src/rebar_agent.erl b/src/rebar_agent.erl
index 0432fb8..674e002 100644
--- a/src/rebar_agent.erl
+++ b/src/rebar_agent.erl
@@ -20,7 +20,7 @@ do(Namespace, Command) when is_atom(Namespace), is_atom(Command) ->
gen_server:call(?MODULE, {cmd, Namespace, Command}, infinity).
init(State) ->
- {ok, Cwd} = file:get_cwd(),
+ Cwd = rebar_dir:get_cwd(),
{ok, #state{state=State, cwd=Cwd}}.
handle_call({cmd, Command}, _From, State=#state{state=RState, cwd=Cwd}) ->
@@ -48,8 +48,8 @@ terminate(_Reason, _State) ->
run(Namespace, Command, RState, Cwd) ->
try
- case file:get_cwd() of
- {ok, Cwd} ->
+ case rebar_dir:get_cwd() of
+ Cwd ->
Args = [atom_to_list(Namespace), atom_to_list(Command)],
CmdState0 = refresh_state(RState, Cwd),
CmdState1 = rebar_state:set(CmdState0, task, atom_to_list(Command)),
diff --git a/src/rebar_dir.erl b/src/rebar_dir.erl
index e226633..7af94ea 100644
--- a/src/rebar_dir.erl
+++ b/src/rebar_dir.erl
@@ -100,7 +100,11 @@ local_cache_dir(Dir) ->
get_cwd() ->
{ok, Dir} = file:get_cwd(),
- Dir.
+ %% On windows cwd may return capital letter for drive,
+ %% for example C:/foobar. But as said in http://www.erlang.org/doc/man/filename.html#join-1
+ %% filename:join/1,2 anyway will convert drive-letter to lowercase, so we have to "internalize"
+ %% cwd as soon as it possible.
+ filename:join([Dir]).
template_globals(State) ->
filename:join([global_config_dir(State), "templates", "globals"]).
diff --git a/src/rebar_git_resource.erl b/src/rebar_git_resource.erl
index 2d83579..dfec86a 100644
--- a/src/rebar_git_resource.erl
+++ b/src/rebar_git_resource.erl
@@ -109,7 +109,7 @@ download(Dir, {git, Url, Rev}, _State) ->
rebar_utils:sh(?FMT("git checkout -q ~s", [Rev]), [{cd, Dir}]).
make_vsn(Dir) ->
- {ok, Cwd} = file:get_cwd(),
+ Cwd = rebar_dir:get_cwd(),
try
ok = file:set_cwd(Dir),
{Vsn, RawRef, RawCount} = collect_default_refcount(),