rootfs

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: MIT Imports: 12 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustPath added in v0.17.0

func MustPath(p string) (r path.Relative)

MustPath is like ParsePath, only that it panics, if the given path is not valid

func MustWD added in v0.17.0

func MustWD() (r path.Relative)

MustWD is like ParseWD, but panics on error

func Normalize added in v0.17.0

func Normalize(p path.Local) path.Relative

Normalize transforms a local path into a path relative to the rootfs, so that it is usable within rootfs it returns a normal relative path on unix and on windows a relative path to an imaginary root that would reside above the drive letters, so that the returned relative path would start with the lowercase drive letter, followed by a slash and the normal rest of the path e.g.

	C:\Windows\Temp  => c/Windows/Temp
	D:\files         => d/files
 /hi/ho           => hi/ho

It is supposed to be used with the rootfs in order to have a crossplattform root fs.

func ParsePath added in v0.17.0

func ParsePath(p string) (r path.Relative, err error)

ParsePath parses an existing local path and returns a normalized path that is relative to rootfs the path might be absolute or relative (than it is relative to the current working directory) the given path must not end in a slash. if p must not be an empty string, or .

func ParseWD added in v0.17.0

func ParseWD() (r path.Relative, err error)

ParseWD parses the working dir and returns a normalized path that is relative to rootfs

Types

type FS

type FS struct {
	// contains filtered or unexported fields
}

func New

func New() (*FS, error)

func NewMock added in v0.17.0

func NewMock() (*FS, error)

func (*FS) Abs

func (fsys *FS) Abs(p path.Relative) path.Absolute

func (FS) Delete added in v0.17.0

func (fsys FS) Delete(p path.Relative, recursive bool) (err error)

func (FS) Drive added in v0.17.0

func (fsys FS) Drive(p path.Relative) (l path.Local, err error)

func (FS) Exists added in v0.17.0

func (fsys FS) Exists(p path.Relative) bool

func (FS) FreeSpace added in v0.17.0

func (fsys FS) FreeSpace(r path.Relative) int64

func (FS) GetMode added in v0.17.0

func (fsys FS) GetMode(p path.Relative) (m fs.FileMode, err error)

should not return mode for a mountpoint (error (not implemented)), should return error (not implemented), if there is no fallback

func (FS) Glob added in v0.17.0

func (fsys FS) Glob(pattern string) (matches []path.Relative, err error)

func (FS) ModTime added in v0.17.0

func (fsys FS) ModTime(p path.Relative) (t time.Time, err error)

func (FS) Move added in v0.17.0

func (fsys FS) Move(src, trgtDir path.Relative) (err error)

func (FS) ReadSeeker added in v0.17.0

func (fsys FS) ReadSeeker(r path.Relative) (io.ReadSeekCloser, error)

func (FS) Reader added in v0.17.0

func (fsys FS) Reader(p path.Relative) (io.ReadCloser, error)

func (FS) Rename added in v0.17.0

func (fsys FS) Rename(p path.Relative, name string) (err error)

func (FS) SetMode added in v0.17.0

func (fsys FS) SetMode(p path.Relative, m fs.FileMode) (err error)

func (FS) Size added in v0.17.0

func (fsys FS) Size(file path.Relative) int64

func (FS) Write added in v0.17.0

func (fsys FS) Write(p path.Relative, rd io.ReadCloser, inbetween bool) (err error)

func (FS) WriteWithMode added in v0.17.0

func (fsys FS) WriteWithMode(p path.Relative, data io.ReadCloser, m fs.FileMode, recursive bool) (err error)

Jump to

Keyboard shortcuts

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