os

package
v0.0.0-...-8fa2440 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2016 License: MIT Imports: 6 Imported by: 15

Documentation

Overview

Package os provides additional OS abstraction functionality for functions not provided by the Go standard library.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotEmpty = errors.New("directory not empty")

Functions

func CacheDir

func CacheDir() string

Returns a directory suitable for storing cached data.

On Windows, this is the 'local' appdata directory. On *NIX, it is XDG_CACHE_DIR (or failing that, $HOME/.cache).

Returns "" if suitable path cannot be identified.

func CacheFilename

func CacheFilename(filename string) string

Returns a filename under the directory returned by CacheDir.

func GetExitCode

func GetExitCode(exitErr error) (exitCode int, err error)

Given an error, determines if that error is an os/exec ExitError. If it is, and the platform is supported, returns the exitCode and nil error. Otherwise, passes through the error, and exitCode is undefined.

func GetFileGID

func GetFileGID(fi os.FileInfo) (int, error)

Returns the GID for a file.

func GetFileUID

func GetFileUID(fi os.FileInfo) (int, error)

Returns the UID for a file.

func IsNotEmpty

func IsNotEmpty(err error) bool

Returns true if the error is ErrNotEmpty or the underlying POSIX error code error is ENOTEMPTY. Currently always returns false on Windows.

func OpenFileNoSymlinks(path string, flags int, mode os.FileMode) (*os.File, error)

Opens a file but does not follow symlinks.

func OpenNoSymlinks(path string) (*os.File, error)

See OpenFileNoSymlinks.

func RemoveEmpty

func RemoveEmpty(path string) error

Delete a tree of empty directories. Returns non-nil error if an empty directory cannot be deleted. Does not return an error if there are non-empty directories. This function can be used to prune empty directories from a tree.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL