ipld-eth-server/vendor/github.com/ipfs/go-ipfs-files/is_hidden_windows.go
Elizabeth Engelman 36533f7c3f Update vendor directory and make necessary code changes
Fixes for new geth version
2019-09-25 16:32:27 -05:00

36 lines
520 B
Go

// +build windows
package files
import (
"path/filepath"
"strings"
windows "golang.org/x/sys/windows"
)
func IsHidden(name string, f Node) bool {
fName := filepath.Base(name)
if strings.HasPrefix(fName, ".") && len(fName) > 1 {
return true
}
fi, ok := f.(FileInfo)
if !ok {
return false
}
p, e := windows.UTF16PtrFromString(fi.AbsPath())
if e != nil {
return false
}
attrs, e := windows.GetFileAttributes(p)
if e != nil {
return false
}
return attrs&windows.FILE_ATTRIBUTE_HIDDEN != 0
}