diff options
author | Viacheslav V. Kovalev <kovyl2404@gmail.com> | 2015-06-01 23:22:02 +0300 |
---|---|---|
committer | Viacheslav Kovalev <kovyl2404@gmail.com> | 2015-06-26 11:24:02 +0300 |
commit | 8138bb92b2ffa7b66768341aa3dac950eb481f3d (patch) | |
tree | d473a53c8c8cc2842d4038be98868895ff697b3f /src/rebar_file_utils.erl | |
parent | ed0b8fca45b4399a08b1803210c92916e2a0ca44 (diff) |
Fix windows-related issues
Diffstat (limited to 'src/rebar_file_utils.erl')
-rw-r--r-- | src/rebar_file_utils.erl | 15 |
1 files changed, 9 insertions, 6 deletions
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]) -> |