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 ¶
- Variables
- func Abs(dir, p string) string
- func CutPrefix(s, prefix string) (string, bool)
- func Equal(a, b string) bool
- func Fold(s string) string
- func FromGitBash(p string) string
- func Guest(p string) string
- func Home() string
- func Host(p string) string
- func In(p, dir string) (string, bool)
- func IsAbs(p string) bool
- func Join(dir, p string) string
- func Real(p string) (string, error)
- func Root(p string) string
Constants ¶
This section is empty.
Variables ¶
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.
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 CutPrefix ¶
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 Fold ¶
Fold is s as the file system compares it: lowercased where case is ignored, as is elsewhere.
func FromGitBash ¶
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 ¶
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 ¶
Host is p, as the OS gave it, in agent-vm's spelling: / separators on Windows, as is elsewhere.
func In ¶
In is p relative to dir, "." for dir itself, compared as the file system does; false when p is not inside dir.
func IsAbs ¶
IsAbs reports whether p is absolute: it starts with /, after its drive on Windows (C:/x).
func Join ¶
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.
Types ¶
This section is empty.