Documentation
¶
Overview ¶
Package path provides path resolution and normalization utilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanonicaliseRoot ¶
func CanonicaliseRoot(fs FileSystem, root string) (string, error)
CanonicaliseRoot canonicalises a workspace root path by making it absolute and resolving symlinks. Returns an error if the path doesn't exist or isn't a directory.
Types ¶
type FileSystem ¶
type FileSystem interface {
ValidateAbs(path string) (string, error)
EvalSymlinks(path string) (string, error)
Stat(path string) (os.FileInfo, error)
}
FileSystem abstracts filesystem operations for path resolution.
type OSFileSystem ¶
type OSFileSystem struct{}
OSFileSystem implements FileSystem using the real OS.
func (OSFileSystem) EvalSymlinks ¶
func (OSFileSystem) EvalSymlinks(path string) (string, error)
EvalSymlinks returns the path after the evaluation of any symbolic links.
func (OSFileSystem) Stat ¶
func (OSFileSystem) Stat(path string) (os.FileInfo, error)
Stat returns a FileInfo describing the named file.
func (OSFileSystem) ValidateAbs ¶
func (OSFileSystem) ValidateAbs(path string) (string, error)
ValidateAbs returns the absolute representation of path.
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver provides path resolution within a workspace boundary.
func NewResolver ¶
NewResolver creates a new path resolver for the given workspace.
func (*Resolver) DisplayPath ¶
DisplayPath formats an absolute or workspace relative path for display purposes. It prioritizes collapsing the home directory to ~, matching the UI design choice.