2 ms·
He can do a test using `errors.Is(err, syscall.ENOTDIR)` func rootInfo(root, p string) (has bool, isDir bool, err error) { p = path.Clean(p) info, err
by lenkite 9mo ago
He can do a test using `errors.Is(err, syscall.ENOTDIR)`
func rootInfo(root, p string) (has bool, isDir bool, err error) {
p = path.Clean(p)
info, err := os.Stat(root + "/" + p)
if info != nil {
has, isDir = true, info.IsDir()
return
}
if errors.Is(err, os.ErrNotExist) || errors.Is(err, syscall.ENOTDIR) {
err = nil
}
return
}