fileutil

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cleanup

func Cleanup(path string)

Cleanup removes the specified file or directory and prints any errors to stderr. It's supposed to be used in defer statements to clean up temporary directories.

func Exists

func Exists(path string) (bool, error)

func IsBelow

func IsBelow(path string, root string) (bool, error)

IsBelow returns true if and only if path lies below or is the path root. path and root must be either both absolute or both relative.

func IsDir

func IsDir(path string) bool

IsDir returns whether this path is a directory. Tries to behave the same as Python's pathlib.Path.is_dir()

func IsSymlink(path string) bool

func PrettifyPath

func PrettifyPath(path string) string

PrettifyPath prints a possibly shortened path for display purposes. If path is located under the current working directory, the relative path to it is returned, otherwise or in case of an error the path is returned unchanged.

func Touch

func Touch(path string) error

Touch creates a file at the given path

Types

This section is empty.

Jump to

Keyboard shortcuts

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