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

Function OpenRootDir

internal/safepaths/root.go:61–69  ·  view source on GitHub ↗

OpenRootDir creates and opens a user-selected directory as a rooted filesystem. The selected path may contain symbolic links; child paths beneath the opened root may not.

(path string, perm os.FileMode)

Source from the content-addressed store, hash-verified

59// The selected path may contain symbolic links; child paths beneath the opened
60// root may not.
61func OpenRootDir(path string, perm os.FileMode) (*Root, error) {
62 if path == "" {
63 path = "."
64 }
65 if err := os.MkdirAll(path, perm); err != nil {
66 return nil, err
67 }
68 return OpenRoot(path)
69}
70
71// OpenFile creates a file without traversing symbolic links below its rooted
72// parent. Creation is always exclusive, including when replace is false.

Callers 5

ensureRootMethod · 0.92
rootedWriteOutputFileFunction · 0.92
createMetadataFileMethod · 0.92
runDownloadFunction · 0.92

Calls 2

OpenRootFunction · 0.85
MkdirAllMethod · 0.80

Tested by 1