github.com/keltia/go-ipfs@v0.3.8-0.20150909044612-210793031c63/commands/files/is_hidden_windows.go (about) 1 // +build windows 2 3 package files 4 5 import ( 6 "path/filepath" 7 "strings" 8 "syscall" 9 ) 10 11 func IsHidden(f File) bool { 12 13 fName := filepath.Base(f.FileName()) 14 15 if strings.HasPrefix(fName, ".") && len(fName) > 1 { 16 return true 17 } 18 19 p, e := syscall.UTF16PtrFromString(f.FileName()) 20 if e != nil { 21 return false 22 } 23 24 attrs, e := syscall.GetFileAttributes(p) 25 if e != nil { 26 return false 27 } 28 return attrs&syscall.FILE_ATTRIBUTE_HIDDEN != 0 29 }