1
0
mirror of https://github.com/golang/go synced 2024-11-23 04:00:03 -07:00

os: add FileMode.IsRegular

API change.

R=golang-dev, r, iant, rsc
CC=golang-dev
https://golang.org/cl/6844048
This commit is contained in:
Brad Fitzpatrick 2012-11-15 11:46:00 -08:00
parent 1395d3d9bf
commit 0d0eff7165

View File

@ -88,6 +88,12 @@ func (m FileMode) IsDir() bool {
return m&ModeDir != 0 return m&ModeDir != 0
} }
// IsRegular reports whether m describes a regular file.
// That is, it tests that no mode type bits are set.
func (m FileMode) IsRegular() bool {
return m&ModeType == 0
}
// Perm returns the Unix permission bits in m. // Perm returns the Unix permission bits in m.
func (m FileMode) Perm() FileMode { func (m FileMode) Perm() FileMode {
return m & ModePerm return m & ModePerm