Open source AI coding agent. Designed for large projects and real world tasks.
Go aiai-agentsai-developer-toolsai-toolsclicommand-linedeveloper-toolsgitgolanggpt-4llmopenaipolyglot-programmingterminalterminal-basedterminal-ui
ensure dir exists before applying
Dane Schneidera33049b2dafc
diff --git a/cli/lib/apply.go b/cli/lib/apply.goindex 3a40e034..1f016a5c 100644--- a/cli/lib/apply.go+++ b/cli/lib/apply.go@@ -307,6 +307,13 @@ func ApplyPlanWithOutput(name string, autoConfirm bool) error {for path, content := range toApply {// Compute destination pathdstPath := filepath.Join(ProjectRoot, path)+ // Create the directory if it doesn't exist+ err := os.MkdirAll(filepath.Dir(dstPath), 0755)+ if err != nil {+ aborted = true+ return fmt.Errorf("failed to create directory %s: %w", filepath.Dir(dstPath), err)+ }+// Write the fileerr = os.WriteFile(dstPath, []byte(content), 0644)if err != nil {