mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 17:31:56 +03:00
52f21e7261
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6524 Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com> GitOrigin-RevId: 919262c2618a1319441ce3730802c06bd5bd450a
26 lines
564 B
Go
26 lines
564 B
Go
package update
|
|
|
|
// shamelessly copied from
|
|
// https://github.com/inconshreveable/go-update/blob/master/hide_windows.go
|
|
|
|
import (
|
|
"syscall"
|
|
"unsafe"
|
|
|
|
"github.com/hasura/graphql-engine/cli/v2/internal/errors"
|
|
)
|
|
|
|
func hideFile(path string) error {
|
|
var op errors.Op = "update.hideFile"
|
|
kernel32 := syscall.NewLazyDLL("kernel32.dll")
|
|
setFileAttributes := kernel32.NewProc("SetFileAttributesW")
|
|
|
|
r1, _, err := setFileAttributes.Call(uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(path))), 2)
|
|
|
|
if r1 == 0 {
|
|
return errors.E(op, err)
|
|
} else {
|
|
return nil
|
|
}
|
|
}
|