1// Copyright 2019 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// +build windows
6
7package modload
8
9import (
10	"os"
11)
12
13// hasWritePerm reports whether the current user has permission to write to the
14// file with the given info.
15func hasWritePerm(_ string, fi os.FileInfo) bool {
16	// Windows has a read-only attribute independent of ACLs, so use that to
17	// determine whether the file is intended to be overwritten.
18	//
19	// Per https://golang.org/pkg/os/#Chmod:
20	// “On Windows, only the 0200 bit (owner writable) of mode is used; it
21	// controls whether the file's read-only attribute is set or cleared.”
22	return fi.Mode()&0200 != 0
23}
24