Documentation ¶
Overview ¶
Package platform provides build options for different platforms. This requires an external C library that our partners won't have, so this file is not compiled when the flag -tags=partners
Index ¶
- Variables
- func FileOwnerAndGroup(finfo os.FileInfo) (uid int, gid int)
- func GetMountPointFromPath(path string) (string, error)
- func GetOwnerAndGroup(finfo os.FileInfo, header *tar.Header)
- func GuessMimeType(absPath string) (mimeType string, err error)
- func GuessMimeTypeByBuffer(buf []byte) (mimeType string, err error)
Constants ¶
This section is empty.
Variables ¶
var IsPartnerBuild = false
IsPartnerBuild will be true when we're building partner tools, and false otherwise.
Functions ¶
func FileOwnerAndGroup ¶
A late addition. Allows us to build apt_validate on all platforms.
func GetMountPointFromPath ¶
On Linux and OSX, this uses df in a safe way (without passing through any user-supplied input) to find the mountpoint of a given file.
func GetOwnerAndGroup ¶
We have a dummy version of this call in posix.go. Windows does not implement the syscall.Stat_t type we need, but the *nixes do. We use this in util.AddToArchive to set owner/group on files being added to a tar archive.
func GuessMimeType ¶
GuessMimeType uses the Mime Magic library to figure out the mime type of the file at absPath. If this can't figure out the mime type, it returns "application/binary".
func GuessMimeTypeByBuffer ¶
GuessMimeTypeByBuffer uses the Mime Magic library to figure out the mime type of the file by examining the first N bytes (however long buffer is). Use this for very large files, when you don't want GuessMimeType to try to read the whole file. Usually, the first few bytes are sufficient for buf. If this can't figure out the mime type, it returns "application/binary".
Types ¶
This section is empty.