MCPcopy Index your code
hub / github.com/1Panel-dev/1Panel / createDirWhenNotExist

Function createDirWhenNotExist

agent/utils/common/sqlite.go:108–120  ·  view source on GitHub ↗
(isDir bool, pathItem string)

Source from the content-addressed store, hash-verified

106}
107
108func createDirWhenNotExist(isDir bool, pathItem string) (string, error) {
109 checkPath := pathItem
110 if !isDir {
111 checkPath = path.Dir(pathItem)
112 }
113 if _, err := os.Stat(checkPath); err != nil && os.IsNotExist(err) {
114 if err = os.MkdirAll(checkPath, os.ModePerm); err != nil {
115 global.LOG.Errorf("mkdir %s failed, err: %v", checkPath, err)
116 return pathItem, err
117 }
118 }
119 return pathItem, nil
120}

Callers 2

LoadDBConnByPathFunction · 0.85
LoadDBConnByPathWithErrFunction · 0.85

Calls 2

MkdirAllMethod · 0.80
StatMethod · 0.45

Tested by

no test coverage detected