watchyourlan/internal/check/path.go
2022-12-29 12:12:06 +07:00

23 lines
299 B
Go

package check
import (
"os"
"path/filepath"
)
// Path - create path if not exist
func Path(path string) {
_, err := os.Stat(path)
if path != "" && err != nil {
dir := filepath.Dir(path)
err = os.MkdirAll(dir, os.ModePerm)
IfError(err)
_, err = os.Create(path)
IfError(err)
}
}