rebar_file_utils: simplify commands on Windows

This commit is contained in:
Jan Klötzke 2011-10-01 13:23:35 +02:00 committed by Tuncer Ayaz
parent 3f9b346dec
commit 0ce5cbab06

View file

@ -82,7 +82,7 @@ mv(Source, Dest) ->
ok; ok;
{win32, _} -> {win32, _} ->
{ok, R} = rebar_utils:sh( {ok, R} = rebar_utils:sh(
?FMT("cmd " "/c move /y \"~s\" \"~s\" 1> nul", ?FMT("move /y \"~s\" \"~s\" 1> nul",
[filename:nativename(Source), [filename:nativename(Source),
filename:nativename(Dest)]), filename:nativename(Dest)]),
[{use_stdout, false}, return_on_error]), [{use_stdout, false}, return_on_error]),
@ -115,14 +115,14 @@ delete_each([File | Rest]) ->
delete_each_dir_win32([]) -> ok; delete_each_dir_win32([]) -> ok;
delete_each_dir_win32([Dir | Rest]) -> delete_each_dir_win32([Dir | Rest]) ->
{ok, []} = rebar_utils:sh(?FMT("cmd /c rd /q /s \"~s\"", {ok, []} = rebar_utils:sh(?FMT("rd /q /s \"~s\"",
[filename:nativename(Dir)]), [filename:nativename(Dir)]),
[{use_stdout, false}, return_on_error]), [{use_stdout, false}, return_on_error]),
delete_each_dir_win32(Rest). delete_each_dir_win32(Rest).
xcopy_win32(Source,Dest)-> xcopy_win32(Source,Dest)->
{ok, R} = rebar_utils:sh( {ok, R} = rebar_utils:sh(
?FMT("cmd /c xcopy \"~s\" \"~s\" /q /y /e 2> nul", ?FMT("xcopy \"~s\" \"~s\" /q /y /e 2> nul",
[filename:nativename(Source), filename:nativename(Dest)]), [filename:nativename(Source), filename:nativename(Dest)]),
[{use_stdout, false}, return_on_error]), [{use_stdout, false}, return_on_error]),
case length(R) > 0 of case length(R) > 0 of