MCPcopy Index your code
hub / github.com/jetify-com/devbox / createDirAndEnsureEmpty

Function createDirAndEnsureEmpty

internal/templates/template.go:82–97  ·  view source on GitHub ↗
(dir string)

Source from the content-addressed store, hash-verified

80}
81
82func createDirAndEnsureEmpty(dir string) error {
83 entries, err := os.ReadDir(dir)
84 if errors.Is(err, os.ErrNotExist) {
85 if err = os.MkdirAll(dir, 0o755); err != nil {
86 return errors.WithStack(err)
87 }
88 } else if err != nil {
89 return errors.WithStack(err)
90 }
91
92 if len(entries) > 0 {
93 return usererr.New("directory %q is not empty", dir)
94 }
95
96 return nil
97}
98
99func ParseRepoURL(repo string) (string, error) {
100 u, err := url.Parse(repo)

Callers 1

InitFromRepoFunction · 0.85

Calls 2

NewFunction · 0.92
IsMethod · 0.80

Tested by

no test coverage detected