Skip to content

Commit 32720bc

Browse files
authored
Merge pull request #3519 from Eileen-Yu/fix/create-path-in-ep-universe
🐛 Ensure external plugin can scaffold files in new directories
2 parents 75d68a8 + 7cdcfa3 commit 32720bc

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pkg/plugins/external/helpers.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,15 @@ func handlePluginResponse(fs machinery.Filesystem, req external.PluginRequest, p
168168
}
169169

170170
for filename, data := range res.Universe {
171-
f, err := fs.FS.Create(filepath.Join(currentDir, filename))
171+
path := filepath.Join(currentDir, filename)
172+
dir := filepath.Dir(path)
173+
174+
// create the directory if it does not exist
175+
if err := os.MkdirAll(dir, 0o750); err != nil {
176+
return fmt.Errorf("error creating the directory: %v", err)
177+
}
178+
179+
f, err := fs.FS.Create(path)
172180
if err != nil {
173181
return err
174182
}

0 commit comments

Comments
 (0)