tractor.dev/toolkit-go@v0.0.0-20241010005851-214d91207d07/engine/fs/watchfs/watcher/ishidden_windows.go (about)

     1  // +build windows
     2  
     3  package watcher
     4  
     5  import (
     6  	"syscall"
     7  )
     8  
     9  func isHiddenFile(path string) (bool, error) {
    10  	pointer, err := syscall.UTF16PtrFromString(path)
    11  	if err != nil {
    12  		return false, err
    13  	}
    14  
    15  	attributes, err := syscall.GetFileAttributes(pointer)
    16  	if err != nil {
    17  		return false, err
    18  	}
    19  
    20  	return attributes&syscall.FILE_ATTRIBUTE_HIDDEN != 0, nil
    21  }