You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

26 lines
392 B

package util
import "os"
func CheckDir(path string) (bool, error) {
_, err := os.Stat(path)
if err == nil {
return true, nil
}
if !os.IsNotExist(err) {
return false, err
}
err = os.MkdirAll(path, os.ModePerm)
if err != nil {
return false, err
}
return true, nil
}
func RemoveDir(path string) error {
err := os.RemoveAll(path)
if err != nil {
return err
}
return nil
}