package filepath

import "github.com/opencontainers/runtime-tools/filepath"

Package filepath implements Go's filepath package with explicit operating systems (and for some functions and explicit working directory). This allows tools built for one OS to operate on paths targeting another OS. For example, a Linux build can determine whether a path is absolute on Linux or on Windows.

Index

Functions

func Abs

func Abs(os, path, cwd string) (_ string, err error)

Abs is a version of path/filepath's Abs with an explicit operating system and current working directory.

func Clean

func Clean(os, path string) string

Clean is an explicit-OS version of path/filepath's Clean.

func IsAbs

func IsAbs(os, path string) bool

IsAbs is a version of path/filepath's IsAbs with an explicit operating system.

func IsAncestor

func IsAncestor(os, pathA, pathB, cwd string) (_ bool, err error)

IsAncestor returns true when pathB is an strict ancestor of pathA, and false where the paths are equal or pathB is outside of pathA. Paths that are not absolute will be made absolute with Abs.

func Join

func Join(os string, elem ...string) string

Join is an explicit-OS version of path/filepath's Join.

func Separator

func Separator(os string) rune

Separator is an explicit-OS version of path/filepath's Separator.

Source Files

abs.go ancestor.go clean.go doc.go join.go separator.go

Version
v0.3.0
Published
Nov 1, 2017
Platform
windows/amd64
Imports
4 packages
Last checked
9 hours ago

Tools for package owners.