mirror of
https://github.com/zoriya/bubbles.git
synced 2026-08-05 12:46:14 +00:00
22 lines
461 B
Go
22 lines
461 B
Go
//go:build windows
|
|
// +build windows
|
|
|
|
package filepicker
|
|
|
|
import (
|
|
"syscall"
|
|
)
|
|
|
|
// IsHidden reports whether a file is hidden or not.
|
|
func IsHidden(file string) (bool, error) {
|
|
pointer, err := syscall.UTF16PtrFromString(file)
|
|
if err != nil {
|
|
return false, err //nolint:wrapcheck
|
|
}
|
|
attributes, err := syscall.GetFileAttributes(pointer)
|
|
if err != nil {
|
|
return false, err //nolint:wrapcheck
|
|
}
|
|
return attributes&syscall.FILE_ATTRIBUTE_HIDDEN != 0, nil
|
|
}
|