fileutil

package
v0.7.7 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: MPL-2.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirExists

func DirExists(filename string) (bool, error)

DirExists returns true if the directory exists

func DirExistsBestEffort

func DirExistsBestEffort(filename string) bool

DirExistsBestEffort returns true if the directory exists and ignores errors

func EnsureUserOwned

func EnsureUserOwned(dir string, owner *user.User) error

EnsureUserOwned changes the files in the directory to be owned by the use and their group, as specified by the provided user.

func ExpandPath

func ExpandPath(s string) string

ExpandPath expands the tilde in the path

func FileExists

func FileExists(filename string) (bool, error)

FileExists returns true if the file exists

func FileExistsBestEffort

func FileExistsBestEffort(filename string) bool

FileExistsBestEffort returns true if the directory exists and ignores errors

func GetUserHomeDirs

func GetUserHomeDirs() (map[string]string, error)

GetUserHomeDirs returns a map of all users and their homedirs

func HomeDir

func HomeDir() (string, *user.User)

HomeDir returns the home directory of the current user, together with the user object who owns it. If SUDO_USER is detected, then that user's home directory will be used instead.

func IsDirWritable

func IsDirWritable(path string) (bool, error)

IsDirWritable returns if the path is a directory that the user can write to

Types

This section is empty.

Jump to

Keyboard shortcuts

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