Ensure that the full output path exists before continuing.

Fixes #362.
Merge pull request #364 from parkr/generate-data-api

Ensure that the full output path exists before continuing.