Create any parent directories that don't exist when using the --create-tulsiproj option. The operation to write the tulsiproj will fail and throw an error if any parent directories don't exist.
PiperOrigin-RevId: 273780444
diff --git a/src/Tulsi/TulsiProjectDocument.swift b/src/Tulsi/TulsiProjectDocument.swift
index d7a5518..0853886 100644
--- a/src/Tulsi/TulsiProjectDocument.swift
+++ b/src/Tulsi/TulsiProjectDocument.swift
@@ -217,6 +217,9 @@
// Ensure that the project's URL is set to the location in which this document is being saved so
// that relative paths can be set properly.
project.projectBundleURL = url
+ // Create any parent directories if they don't yet exist.
+ try FileManager.default.createDirectory(
+ at: url.deletingLastPathComponent(), withIntermediateDirectories: true)
try super.writeSafely(to: url, ofType: typeName, for: saveOperation)
}