github.com/sandwich-go/boost@v1.3.29/xos/hide.go (about) 1 package xos 2 3 import ( 4 "os" 5 "path/filepath" 6 "strings" 7 ) 8 9 // IsHiddenOrInHiddenDir 判断指定文件是否为隐藏文件,或者包含在隐藏目录中 10 func IsHiddenOrInHiddenDir(path string) (bool, error) { 11 ss := strings.Split(path, string(os.PathSeparator)) 12 var s string 13 for _, v := range ss { 14 s = filepath.Join(s, v) 15 is, err := IsHidden(s) 16 if err != nil || is { 17 return is, err 18 } 19 } 20 return false, nil 21 }