[Support][Path] Don't inf loop if creating the parent directory fails.

Patch by Paul Robinson.