Use ensureCreateDirectory.
Add FileReference extension