filesystem

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 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 Linker

type Linker interface {
	// CreateLink creates a symlink to the path target at path linkName. It
	// will also create any missing directories if the underlying filesystem
	// supports it. The target may be an absolute path.
	CreateLink(target, linkName string) error

	// ReadLink fetches path that the link located at name points to.
	ReadLink(name string) (string, error)

	// RemoveLink removes the link at the specified path. Any parent
	// directories that are left empty must be removed by the implementation.
	RemoveLink(name string) error

	// Sub returns a Linker rooted at the subdirectory dir inside of the
	// current Linker's root. If dir is ".", the linker remains unchanged.
	Sub(dir string) (Linker, error)

	Root() string
}

Linker is an interface for creating symlinks inside of a filesystem. It implements a similar interface to FS in io/fs. The Linker has a root path that all other paths are relative to and implementors of this interface must not support absolute paths unless it is specifically indicated that they are allowed.

type Path

type Path string

func MakePath

func MakePath(names ...string) Path

func (Path) Basename

func (p Path) Basename() string

func (Path) Empty

func (p Path) Empty() (bool, error)

func (Path) Exists

func (p Path) Exists() (bool, error)

func (Path) Join

func (p Path) Join(names ...string) Path

func (Path) MkdirAll

func (p Path) MkdirAll(perm os.FileMode) error

func (Path) Open

func (p Path) Open() (*os.File, error)

func (Path) Parent

func (p Path) Parent() Path

func (Path) Parents

func (p Path) Parents() []Path

func (Path) ReadDir

func (p Path) ReadDir() ([]fs.DirEntry, error)
func (p Path) Readlink() (Path, error)

func (Path) Remove

func (p Path) Remove() error

func (Path) RemoveAll

func (p Path) RemoveAll() error

func (Path) String

func (p Path) String() string
func (p Path) Symlink(target Path) error

func (Path) Walk

func (p Path) Walk(f filepath.WalkFunc) error

func (Path) WriteFile

func (p Path) WriteFile(data []byte, perm os.FileMode) error

Jump to

Keyboard shortcuts

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