fix for cp_r_win32 where copying a directory to a non-existant directory would crash #187
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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):
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
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