MCPcopy Create free account
hub / github.com/cli/cli / rootedWriteOutputFile

Function rootedWriteOutputFile

pkg/cmd/repo/read-file/read_file.go:322–333  ·  view source on GitHub ↗
(dir, name string, data []byte, perm os.FileMode, replace bool)

Source from the content-addressed store, hash-verified

320}
321
322func rootedWriteOutputFile(dir, name string, data []byte, perm os.FileMode, replace bool) error {
323 if dir == "" {
324 return safepaths.WriteFile(name, data, perm, 0o755, replace)
325 }
326
327 root, err := safepaths.OpenRootDir(dir, 0o755)
328 if err != nil {
329 return err
330 }
331 defer root.Close()
332 return root.WriteFile(name, data, perm, 0o755, replace)
333}

Callers

nothing calls this directly

Calls 4

WriteFileFunction · 0.92
OpenRootDirFunction · 0.92
WriteFileMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected