浏览代码

Fix for different robocopy behaviour when moving files or folders.

pull/581/head
CarlosEDP 9 年前
父节点
当前提交
6d3fa8dd66
共有 1 个文件被更改,包括 23 次插入11 次删除
  1. +23
    -11
      src/rebar_file_utils.erl

+ 23
- 11
src/rebar_file_utils.erl 查看文件

@ -155,10 +155,18 @@ mv(Source, Dest) ->
[{use_stdout, false}, abort_on_error]), [{use_stdout, false}, abort_on_error]),
ok; ok;
{win32, _} -> {win32, _} ->
Res = rebar_utils:sh(
?FMT("robocopy \"~s\" \"~s\" /move /s 1> nul",
case filelib:is_dir(Source) of
true ->
Cmd = ?FMT("robocopy /move /s \"~s\" \"~s\" 1> nul",
[filename:nativename(Source), [filename:nativename(Source),
filename:nativename(Dest)]),
filename:nativename(Dest)]);
false ->
Cmd = ?FMT("robocopy /move /s \"~s\" \"~s\" \"~s\" 1> nul",
[filename:nativename(filename:dirname(Source)),
filename:nativename(Dest),
filename:basename(Source)])
end,
Res = rebar_utils:sh(Cmd,
[{use_stdout, false}, return_on_error]), [{use_stdout, false}, return_on_error]),
case win32_ok(Res) of case win32_ok(Res) of
true -> ok; true -> ok;
@ -249,14 +257,18 @@ delete_each_dir_win32([Dir | Rest]) ->
xcopy_win32(Source,Dest)-> xcopy_win32(Source,Dest)->
%% "xcopy \"~s\" \"~s\" /q /y /e 2> nul", Chanegd to robocopy to %% "xcopy \"~s\" \"~s\" /q /y /e 2> nul", Chanegd to robocopy to
%% handle long names. May have issues with older windows. %% handle long names. May have issues with older windows.
Res = rebar_utils:sh(
?FMT("robocopy \"~s\" \"~s\" \"~s\" /e /is /purge 2> nul",
[filename:nativename(filename:dirname(Source)),
filename:nativename(Dest),
filename:basename(Source)]),
% ?FMT("robocopy \"~s\" \"~s\" /e /is /purge 2> nul",
% [filename:nativename(Source), filename:nativename(Dest)]),
case filelib:is_dir(Source) of
true ->
Cmd = ?FMT("robocopy \"~s\" \"~s\" /e /is 1> nul",
[filename:nativename(Source),
filename:nativename(Dest)]);
false ->
Cmd = ?FMT("robocopy \"~s\" \"~s\" \"~s\" /e /is 1> nul",
[filename:nativename(filename:dirname(Source)),
filename:nativename(Dest),
filename:basename(Source)])
end,
Res = rebar_utils:sh(Cmd,
[{use_stdout, false}, return_on_error]), [{use_stdout, false}, return_on_error]),
case win32_ok(Res) of case win32_ok(Res) of
true -> ok; true -> ok;

正在加载...
取消
保存