Browse Source

update: create folder

v1.x.x
dnomd343 2 years ago
parent
commit
65f0c5a0fa
  1. 6
      cmd/common/file.go

6
cmd/common/file.go

@ -11,9 +11,13 @@ import (
) )
func CreateFolder(folderPath string) { func CreateFolder(folderPath string) {
folder, err := os.Stat(folderPath)
if err == nil && folder.IsDir() { // folder exist -> skip create process
return
}
log.Debugf("Create folder -> %s", folderPath) log.Debugf("Create folder -> %s", folderPath)
if err := os.MkdirAll(folderPath, 0755); err != nil { if err := os.MkdirAll(folderPath, 0755); err != nil {
log.Panicf("Failed to create folder -> %s", folderPath) log.Errorf("Failed to create folder -> %s", folderPath)
} }
} }

Loading…
Cancel
Save