Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Abs ¶
Abs returns an absolute representation of path, but handles case-insensitive filesystems as described in the comment on Getwd for the case where the path is relative and the cwd needs to be obtained
func ExpandHomeDir ¶
ExpandHomeDir expands a given path to its absolute form, handling home directory
func Getwd ¶
Getwd returns the current working directory, but handles case-insensitive filesystems (i.e. MacOS defaults) and returns the path with the casing as it appears when doing list dir syscalls. For example, on a case-insensitive filesystem, you can do "cd /FoO/bAr" and os.Getwd will return "/FoO/bAr", but if you do "ls /" you may see "fOO" and if you do "ls /fOO" you may see "BAR", which creates inconsistent paths depending on if you are using Getwd or walking the filesystem.
func LexicalRelativePath ¶
LexicalRelativePath computes a relative path between the current working directory and modPath without relying on runtime.GOOS to estimate OS-specific separators. This is necessary as the code runs inside a Linux container, but the user might have specified a Windows-style modPath.
func SandboxedRelativePath ¶ added in v0.20.0
SandboxedRelativePath resolves userPath relative to root, ensuring the result stays within root. Absolute paths (including Windows drive-letter paths) are treated as relative to root. Returns an error if the resolved path would escape root via "..".
Both root and the returned path use forward slashes. Backslashes in userPath are normalized to forward slashes so that Windows-style paths are handled correctly even though the engine always runs on Linux.
Types ¶
This section is empty.