Documentation
¶
Index ¶
- func CanOverwrite(path string) (bool, error)
- func CanStat(path string) bool
- func CatchAndForwardSignals(proc *os.Process) func()
- func CurrentUserHomeDir() (string, error)
- func IsDebianBased() bool
- func IsRootOrHomeSubPath(path string) bool
- func IsSubDir(parent, child string) bool
- func IsSubDirOrSame(parent, child string) bool
- func MkdirAll(path string) error
- func TildeToHomeDir(path string, homeDir string) string
- func ValidateRelPath(path string) error
- func ValidateRootOrHomeSubPath(path string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanOverwrite ¶ added in v0.1.5
CanOverwrite returns true if the current user can be able to overwrite a file located at path.
func CatchAndForwardSignals ¶ added in v0.1.5
CatchAndForwardSignals installs handlers for catchable shutdown signals. When such signal is delivered to the parent, it is forwarded to proc; if proc is still alive after 2 seconds it is killed with SIGKILL. Returns a function that should be called when process to which signals are forwarded terminates.
func CurrentUserHomeDir ¶
CurrentUserHomeDir returns the home directory of the current user.
func IsDebianBased ¶
func IsDebianBased() bool
IsDebianBased returns true if the system is Debian-based by checking for the presence of /etc/debian_version file.
func IsRootOrHomeSubPath ¶
func IsSubDirOrSame ¶
IsSubDirOrSame returns true if child is a sub directory of the parent or if they are the same directory.
func MkdirAll ¶
MkdirAll is a simple wrapper over os.MkdirAll. It always uses permissions 0700 and returns verbose error which can be propagated up without adding an aditional context.
func TildeToHomeDir ¶
TildeToHomeDir replaces tilde in a path with the given homeDir path. Does not handle tildes followed by username (~bob).
func ValidateRelPath ¶
ValidateRelPath validates that path is a relative path and is normalized.
func ValidateRootOrHomeSubPath ¶
ValidateRootOrHomeSubPath validates that a path is a subpath of root or of a ~/, and is normalized.
Types ¶
This section is empty.