relpath

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs(path string) (string, error)

Abs returns a best-effort absolute representation of path. The returned path may be relative on platforms such as WebAssembly. If the path is not absolute it will be joined with the current working directory to turn it into an absolute path. See filepath.Abs for more information.

func CallerRel

func CallerRel(path string) string

CallerRel returns a source-file relative path. Used for testing when PWD is not set, such as running tests under wasm/wasip1. This does not work in TinyGo (missing runtime.Caller support).

func Getwd

func Getwd() (string, error)

Getwd returns best-effort path to the current working directory, even on WebAssembly. The path may be absolute, or it may be relative, prefixed with one or more ".." segments.

func Rel

func Rel(base, target string) string

Rel returns a best-effort relative path. If an error occurs trying to make target relative to base, target is returned unmodified.

func Walk

func Walk(dir string, f func(path string) error, patterns ...string) error

Walk walks the files in directory dir, passing them to func f. Supply glob patterns (e.g. "*.wit.json") to filter files passed to f.

Types

This section is empty.

Jump to

Keyboard shortcuts

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