Fix problems with base_file containing a directory #1371
Merged
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 adds a new function to the
ProjectHandler
class that retrieves the full path to the output file for the specified form and language. This also eliminates a duplicate single-level folder. E.g., given a project output file calledgenerate
and a form base_file calledgenerate/my_form
this will remove the duplicategenerate
folder. The upside is that this will fix the most common error where the folder portion was entered by hand even though it wasn't needed. It will, however, prevent the user from specifying nested folders containing the same name (i.e.,generate/generate/my_form
won't work if project output directory is set togenerate/
).The second part of this PR adds a
isGenerating()
to App and uses that in FileCodeWriter::WriteFile() to determine whether or not to ask the user permission to create a directory that was specified, but doesn't exist. This allows the code writer to create a missing directory as long as code generation is running from the command line.See #1366