Documentation ¶
Index ¶
- func AbsPath(base *string) error
- func IsNotExist(err error) bool
- func MakeDirs(path string) error
- func MakePathUserWritable(path string, fi os.FileInfo) error
- func MakeReadOnly(path string, filter func(string) bool) error
- func RemoveAll(path string) error
- func Touch(path string, when time.Time, mode os.FileMode) error
- type TempDir
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AbsPath ¶
AbsPath is a convenience wrapper around filepath.Abs that accepts a string pointer, base, and updates it on successful resolution.
func IsNotExist ¶
IsNotExist calls os.IsNotExist on the unwrapped err.
func MakeDirs ¶
MakeDirs is a convenience wrapper around os.MkdirAll that applies a 0755 mask to all created directories.
func MakePathUserWritable ¶
MakePathUserWritable updates the filesystem metadata on a single file or directory to make it user-writable.
fi is optional. If nil, os.Stat will be called on path. Otherwise, fi will be regarded as the results of calling os.Stat on path. This is provided as an optimization, since some filesystem operations automatically yield a FileInfo.
func MakeReadOnly ¶
MakeReadOnly recursively iterates through all of the files and directories starting at path and marks them read-only.
func RemoveAll ¶
RemoveAll is a fork of os.RemoveAll that attempts to deal with read only files and directories by modifying permissions as necessary.
If the specified path does not exist, RemoveAll will return nil.
Note that RemoveAll will not modify permissions on parent directory of the provided path, even if it is read only and preventing deletion of the path on POSIX system.
Copied from https://go.googlesource.com/go/+/b86e76681366447798c94abb959bb60875bcc856/src/os/path.go#63
Types ¶
type TempDir ¶
type TempDir struct { // Dir is the base diectory. If empty, the default will be used (see // ioutil.TempDir) Dir string // Prefix is the prefix to apply to the temporary directory. If empty, a // default will be used (see ioutil.TempDir). Prefix string // OnCleanupErr, if not nil, will be called if TempDir cleanup fails. // // If nil, cleanup errors will be silently discarded. CleanupErrFunc func(tdir string, err error) }
TempDir configures a temporary directory.
func (*TempDir) With ¶
With creates a temporary directory and passes it to fn. After fn exits, the directory and all of its contents is deleted.
Any error that happens during setup or execution of the callback is returned. If an error occurs during cleanup, the optional CleanupErrFunc will be called.