소스 검색

Fix copying dir to non-existing dir in Win32

pull/3/head
Jesse Gumm 13 년 전
committed by Tuncer Ayaz
부모
커밋
33546cc402
1개의 변경된 파일19개의 추가작업 그리고 0개의 파일을 삭제
  1. +19
    -0
      src/rebar_file_utils.erl

+ 19
- 0
src/rebar_file_utils.erl 파일 보기

@ -150,6 +150,25 @@ cp_r_win32({false, Source},{false, Dest}) ->
%% from file to file
{ok,_} = file:copy(Source, Dest),
ok;
cp_r_win32({true, SourceDir}, {false, DestDir}) ->
case filelib:is_regular(DestDir) of
true ->
%% From directory to file? This shouldn't happen
{error, lists:flatten(
io_lib:format("Cannot copy dir (~p) to file (~p)\n",
[SourceDir, DestDir]))};
false ->
%% Specifying a target directory that doesn't currently exist.
%% So let's attempt to create this directory
case filelib:ensure_dir(filename:join(DestDir, "dummy")) of
ok ->
ok = xcopy_win32(SourceDir, DestDir);
{error, Reason} ->
{error, lists:flatten(
io_lib:format("Unable to create dir ~p: ~p\n",
[DestDir, Reason]))}
end
end;
cp_r_win32(Source,Dest) ->
Dst = {filelib:is_dir(Dest), Dest},
lists:foreach(fun(Src) ->

불러오는 중...
취소
저장