path

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilePath

type FilePath string

func New

func New(path string) FilePath

New returns a file path. if you call some method on filePath object, will not change its original content

func (FilePath) Abs

func (f FilePath) Abs() (FilePath, error)

Abs returns an absolute representation of path.

func (FilePath) Base

func (f FilePath) Base() string

Base returns the last element of path.

func (FilePath) Dir

func (f FilePath) Dir() FilePath

Dir returns the directory part of path.

func (FilePath) Ext

func (f FilePath) Ext() string

Ext returns the file name extension.

func (FilePath) HasExt

func (f FilePath) HasExt(ext string) bool

HasExt returns true if the path has the given extension.

func (FilePath) IsAbs

func (f FilePath) IsAbs() bool

IsAbs returns true if the path is absolute.

func (FilePath) IsDir

func (f FilePath) IsDir() bool

IsDir returns true if the path is a directory.

func (FilePath) IsExist

func (f FilePath) IsExist() bool

IsExist returns true if the path exists.

func (FilePath) IsFile

func (f FilePath) IsFile() bool

IsFile returns true if the path is a file.

func (FilePath) IsGitRepo

func (f FilePath) IsGitRepo() bool

IsGitRepo returns true if the path is a git repo.

func (FilePath) Join

func (f FilePath) Join(path ...string) FilePath

Join joins any number of path elements into a single path, adding a separator

func (FilePath) Match added in v0.1.2

func (f FilePath) Match(pattern string) bool

Match returns true if `f` matches the file name `pattern`

func (FilePath) Rel

func (f FilePath) Rel(base string) (FilePath, error)

Rel returns the f's relative path from base.

func (FilePath) String

func (f FilePath) String() string

String returns the path as a string.

func (FilePath) Walk

func (f FilePath) Walk(fn walkFunc) error

Jump to

Keyboard shortcuts

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