paths

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LocalFilePath

type LocalFilePath struct{}

abstraction of "path/filepath" methods

func (*LocalFilePath) Abs

func (*LocalFilePath) Abs(path string) (string, error)

same as filepath.Abs

func (*LocalFilePath) Base

func (*LocalFilePath) Base(path string) string

Base returns the last element of path. Trailing path separators are removed before extracting the last element. If the path is empty, Base returns ".". If the path consists entirely of separators, Base returns a single separator.

func (*LocalFilePath) Clean

func (*LocalFilePath) Clean(path string) string

Clean returns the shortest path name equivalent to path by purely lexical processing. See "path/filepath.Clean"

func (*LocalFilePath) Dir

func (*LocalFilePath) Dir(path string) string

same as filepath.Dir, but also work with path ending with a slash/sep

func (*LocalFilePath) FromSlash

func (*LocalFilePath) FromSlash(path string) string

FromSlash returns the result of replacing each slash ('/') character in path with a separator character. Multiple slashes are replaced by multiple separators.

func (*LocalFilePath) IsAbs

func (*LocalFilePath) IsAbs(path string) bool

checks if path is absolute

func (*LocalFilePath) Join

func (*LocalFilePath) Join(elem ...string) string

same as filepath.Join

func (*LocalFilePath) JoinColor

func (*LocalFilePath) JoinColor(color string, reset string, elem ...string) string

same as Join, but give a color to path sep (slash or backslash)

func (*LocalFilePath) Rel

func (*LocalFilePath) Rel(basepath, targpath string) (string, error)

same as filepath.Rel

func (*LocalFilePath) Split

func (*LocalFilePath) Split(path string) (string, string)

Split splits path immediately following the final Separator, separating it into a directory and file name component. If there is no Separator in path, Split returns an empty dir and file set to path. The returned values have the property that path = dir+file.

func (*LocalFilePath) SplitAll

func (*LocalFilePath) SplitAll(path string) []string

func (*LocalFilePath) SplitExt

func (*LocalFilePath) SplitExt(filename string) *common.ParsedName

SplitExt returns {basename, ext, suffix} for example: filename="test.ZIP" -> {"test", ".ZIP", ""} filename="test.ZIP.1" -> {"test", ".ZIP", ".1"} filename="lib.so.1.2.3" -> {"lib", ".so.1", ".1.2.3"}

Jump to

Keyboard shortcuts

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