Implement ensurePathExists method