Пример #1
0
func isPathWriteable(p gopath.GoPath) bool {
	if p.IsDirectory() {
		return isDirWriteable(p)
	}

	return isFileWriteable(p)
}
Пример #2
0
func (m *mimeDetector) mimeTypeForPath(p gopath.GoPath) string {
	p = p.EvalSymlinks()
	if p.IsDirectory() || p.HasErr() {
		return store.FallbackMimeType
	}

	var ext = p.Ext()
	if mimeType := mime.TypeByExtension(ext); mimeType != "" {
		return mimeType
	}

	var first512Bytes = m.first512BytesForPath(p)
	m.errAndClear() // clear error flag, as DetectContentType always returns something

	return http.DetectContentType(first512Bytes)
}
Пример #3
0
func (a *accessControl) canWriteDirectory(p gopath.GoPath) bool {
	if p.HasErr() || !p.IsDirectory() {
		return false
	}
	return a.hasWorldWritePermission(p.FileMode())
}