Files
sundynix-plant-be/utils/directory.go
T
2026-02-06 14:44:06 +08:00

21 lines
297 B
Go

package utils
import (
"errors"
"os"
)
func PathExist(path string) (bool, error) {
stat, err := os.Stat(path)
if err == nil {
if stat.IsDir() {
return true, nil
}
return false, errors.New("存在同名文件")
}
if os.IsNotExist(err) {
return false, nil
}
return false, err
}