ospath

package
v0.33.21 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Child

func Child(dir string, file string) (string, bool)

Given absolute paths `dir` and `file`, returns the relative path of `file` relative to `dir`.

Returns true if successful. If `file` is not under `dir`, returns false.

TODO(nick): Should we have an assertion that dir and file are absolute? This is a common mistake when using this API. It won't work correctly with relative paths.

func FileDisplayName added in v0.7.11

func FileDisplayName(baseDirs []string, f string) string

Calculate a display name for a file by figuring it out what basedir it's relative to and trimming the basedir prefix off the front

func FileListDisplayNames added in v0.7.11

func FileListDisplayNames(baseDirs []string, files []string) []string

Calculate display name for list of files.

func FormatFileChangeList added in v0.10.9

func FormatFileChangeList(changedFiles []string) string
func IsBrokenSymlink(path string) (bool, error)

func IsChild added in v0.7.11

func IsChild(dir string, file string) bool

IsChild returns true if the given file is a child of the given directory

func IsChildOfOne added in v0.7.12

func IsChildOfOne(dirs []string, file string) bool

IsChildOfOne returns true if the given file is a child of (at least) one of the given directories.

func IsDir

func IsDir(path string) bool

func IsRegularFile added in v0.4.1

func IsRegularFile(path string) bool

func MustAbs added in v0.14.0

func MustAbs(path string) string

filepath.Abs for testing

func RealAbs

func RealAbs(path string) (string, error)

Returns the absolute version of this path, resolving all symlinks.

func RealChild

func RealChild(dir string, file string) (string, bool, error)

func Realwd

func Realwd() (string, error)

Like os.Getwd, but with all symlinks resolved.

func TryAsCwdChildren

func TryAsCwdChildren(absPaths []string) []string

TryAsCwdChildren converts the given absolute paths to children of the CWD, if possible (otherwise, leaves them as absolute paths).

Types

This section is empty.

Jump to

Keyboard shortcuts

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