mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 17:31:56 +03:00
23 lines
452 B
Go
23 lines
452 B
Go
package update
|
|
|
|
// shamelessly copied from
|
|
// https://github.com/inconshreveable/go-update/blob/master/hide_windows.go
|
|
|
|
import (
|
|
"syscall"
|
|
"unsafe"
|
|
)
|
|
|
|
func hideFile(path string) error {
|
|
kernel32 := syscall.NewLazyDLL("kernel32.dll")
|
|
setFileAttributes := kernel32.NewProc("SetFileAttributesW")
|
|
|
|
r1, _, err := setFileAttributes.Call(uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(path))), 2)
|
|
|
|
if r1 == 0 {
|
|
return err
|
|
} else {
|
|
return nil
|
|
}
|
|
}
|