paths

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package paths compares and joins host paths as agent-vm's checks need: textually, as `cd` does, and whatever the case where the file system ignores it.

Host paths are spelled with / separators everywhere: on Windows, C:/Users/me (Host), which Go's file functions take as they take C:\Users\me.

Index

Constants

This section is empty.

Variables

View Source
var NoCase = func() bool {
	return runtime.GOOS == "darwin" || Windows()
}

NoCase reports whether this host's file systems ignore case by default: macOS, Windows. A variable, for tests.

View Source
var Windows = func() bool { return runtime.GOOS == "windows" }

Windows reports whether host paths are Windows ones, with a drive. A variable, for tests.

Functions

func Abs

func Abs(dir, p string) string

Abs is p made absolute against dir, as Join, an absolute p against its root.

func CutPrefix

func CutPrefix(s, prefix string) (string, bool)

CutPrefix is s without prefix, compared as the file system does, and whether s starts with it. The rest is s's own spelling: case folding can change the length of a string, so it is cut where the match ends in s.

func Equal

func Equal(a, b string) bool

Equal compares two paths as the file system does.

func Fold

func Fold(s string) string

Fold is s as the file system compares it: lowercased where case is ignored, as is elsewhere.

func FromGitBash

func FromGitBash(p string) string

FromGitBash is p, on Windows, with Git Bash's spelling of a drive (/c/x, as 0.2's volumes file has it) made a drive again (C:/x); as is elsewhere.

func Guest

func Guest(p string) string

Guest is the host path p as 0.2 spelled it, which is the path the VM sees it at, and which VM names hash: as is, but for Windows, where Git Bash spelled C:\Users\x as /c/Users/x.

func Home

func Home() string

Home is the user's home folder, spelled as Host does; "" when unknown.

func Host

func Host(p string) string

Host is p, as the OS gave it, in agent-vm's spelling: / separators on Windows, as is elsewhere.

func In

func In(p, dir string) (string, bool)

In is p relative to dir, "." for dir itself, compared as the file system does; false when p is not inside dir.

func IsAbs

func IsAbs(p string) bool

IsAbs reports whether p is absolute: it starts with /, after its drive on Windows (C:/x).

func Join

func Join(dir, p string) string

Join is dir/p, with "." and ".." resolved in the text, as `cd` does: a path that only goes through dir on its way out of it (../x) names a file outside. The root ("/", "C:/") when nothing is left: ".." stops there.

func Real

func Real(p string) (string, error)

Real is p with its links resolved (filepath.EvalSymlinks), spelled as Host does.

func Root

func Root(p string) string

Root is p's root: "/", or its drive's ("C:/") on Windows.

Types

This section is empty.

Jump to

Keyboard shortcuts

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