pathutil

package
v0.0.0-...-c39e8e5 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: AGPL-3.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DotRelative

func DotRelative(base, full string) string

DotRelative returns the relative path of full to base. The return value starts with a dot if base is a parent of full. It returns full unchanged if base is not a parent of full.

func Exist

func Exist(name string) error

Exist creates an error where the given path already exists.

func Invalid

func Invalid(name string) error

Invalid creates an error where the given path is invalid.

func IsDir

func IsDir(name string) error

IsDir creates an error where the given path is a directory.

func IsNotExist

func IsNotExist(err error) bool

IsNotExist returns true if the error means that a path does not exist as a file. It could be that the file is a directory/tree.

func IsParent

func IsParent(short, long string) bool

IsParent checks if path short is a parent of path long.

func NotAbs

func NotAbs(name string) error

NotAbs creates an error where the given path is not absolute.

func NotDir

func NotDir(name string) error

NotDir creates an error where the given path is not a directory.

func NotExist

func NotExist(name string) error

NotExist creates an error where the given path does not exist.

func ReadOnly

func ReadOnly(name string) error

ReadOnly creates an error where the given path is read-only.

func Relative

func Relative(base, full string) string

Relative returns the relative path of full to base. It returns the relative path if base is a parent of full. It returns a single dot if base and full are the same. It retunrs an empty string if base is not a parent of full.

func Split

func Split(path string) ([]string, error)

Split splits the package name into parts.

func ValidPath

func ValidPath(p string) bool

ValidPath checks if p is a valid absolute path

func ValidPathRune

func ValidPathRune(r rune) bool

ValidPathRune checks if r is a valid rune in the path. Valid runes contains a-z, A-Z, 0-9, '_' and '.'

Types

This section is empty.

Jump to

Keyboard shortcuts

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