ensure dest exists before copying to it and fix src_dirs symlinking #1770
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.
This PR augments what is found at #1763 by @danikp
Original Description
While using src_dirs options it's possible to set first level directories under app folder, but setting something deeper will fail on copying files to _build folder. so following example will work
and this one not
failing with error
that happens cause cp command not creating missing path parts. This PR comes to solve it by trying to create destination folder with all parent folders in path.
Difference with Original
The original branch had a test we both worked on, but that had an issue when setting multiple values of
src_dirs
such as{src_dirs, ["alt/nested", "src"]}
if either of the directories did not exist in one of the umbrella applications. The original PR relaxed the test so this was not a problem anymore, and this branch reinstates that configuration, and instead fixes the problem by adding a check in the compiler.It appears that a check to know if the source directory existed was already in place for file copying, but not for symlinking. The check is added to the symlink operation.
This branch has been tested both on Linux and on Windows 10.
Question for @tsloughter and @talentdeficit : any reason why the source directory check was not on symlink calls? I'm afraid of accidentally breaking something, but this seems to work fine.