Beispiel #1
0
// getRelevantFileModeForPath returns the FileMode for the given file or, when
// the file does not exist, its containing directory.
func (a *accessControl) relevantFileModeForPath(p gopath.GoPath) os.FileMode {
	if a.hasErr() || p.HasErr() {
		return 0
	}
	var pStat = p.Stat()
	if !pStat.IsExists() {
		// HINT: Inspect permissions of containing directory
		pStat = p.Dir().Stat()
	}
	a.setErr(pStat.Err())
	return pStat.FileMode()
}