(isDir bool, pathItem string)
| 106 | } |
| 107 | |
| 108 | func 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 | } |
no test coverage detected