basho/rebar — pull request #187 by choptastic (2012-02-16 05:15:19+00:00)
Title: fix for cp_r_win32 where copying a directory to a non-existant directory would crash

Hi!

Previously, on windows, rebar_file_utils:cp_r_win32 would throw an error copying a directory to a non-existant directory where linux would handle it just fine.

Example from a reltool (assuming site/static exists, but is empty):

```erlang
{copy, "../deps/nitrogen_core/www", "site/static/nitrogen"},
```

On linux, this would work, properly copying "../deps/nitrogen_core/www" to "site/static/nitrogen", creating the "nitrogen" directory in the process. On windows, it would crash because nitrogen didn't exist. This patch fixes that, and will allow it to more closely simulate the linux experience.

To be more specific, for the function call matching

```erlang
cp_r_win32({true,SourceDir},{false,DestDir})
```
It would fail, since DestDir was previously checked to be a dir (first line of cp_r_win32(Source,Dest) ) and since it didn't exist, it's also not a Dir. My fix here accounts for that and if it's determined to also not be a file, then it doesn't exist and it attempts to make the directory to copy into.

Thanks,

-Jesse