From 8138bb92b2ffa7b66768341aa3dac950eb481f3d Mon Sep 17 00:00:00 2001 From: "Viacheslav V. Kovalev" Date: Mon, 1 Jun 2015 23:22:02 +0300 Subject: Fix windows-related issues --- src/rebar_file_utils.erl | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/rebar_file_utils.erl') diff --git a/src/rebar_file_utils.erl b/src/rebar_file_utils.erl index ad30172..915da9a 100644 --- a/src/rebar_file_utils.erl +++ b/src/rebar_file_utils.erl @@ -120,21 +120,24 @@ mv(Source, Dest) -> [{use_stdout, false}, abort_on_error]), ok; {win32, _} -> - {ok, R} = rebar_utils:sh( - ?FMT("move /y \"~s\" \"~s\" 1> nul", + Res = rebar_utils:sh( + ?FMT("robocopy /move /e \"~s\" \"~s\" 1> nul", [filename:nativename(Source), filename:nativename(Dest)]), [{use_stdout, false}, return_on_error]), - case R of - [] -> - ok; - _ -> + case win32_robocopy_ok(Res) of + true -> ok; + false -> {error, lists:flatten( io_lib:format("Failed to move ~s to ~s~n", [Source, Dest]))} end end. +win32_robocopy_ok({ok, _}) -> true; +win32_robocopy_ok({error, {Rc, _}}) when Rc<9, Rc==16 -> true; +win32_robocopy_ok(_) -> false. + delete_each([]) -> ok; delete_each([File | Rest]) -> -- cgit v1.1