mirror of
https://github.com/golang/go
synced 2024-11-23 03:40:02 -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:
parent
1395d3d9bf
commit
0d0eff7165
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user