pathutil

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalPath

func CanonicalPath(path string) (string, error)

CanonicalPath returns the absolute path with correct filesystem case. Unlike NormalizeForLookup, this preserves the actual case from the filesystem, which is important for matching paths used by external tools (e.g., Claude's project paths). On macOS, this ensures /users/foo becomes /Users/foo to match the real directory name.

Note: filepath.EvalSymlinks does NOT canonicalize case on macOS, so we walk each path component and look up the correct case from the filesystem.

func ComparePaths

func ComparePaths(path1, path2 string) (bool, error)

ComparePaths checks if two paths refer to the same location, respecting OS case sensitivity.

func Expand

func Expand(path string) (string, error)

Expand expands home directory (~), environment variables, and git variables in a path. It returns an absolute path.

func NormalizeForLookup

func NormalizeForLookup(path string) (string, error)

NormalizeForLookup creates a canonical, case-normalized path suitable for use as a map key or in comparisons. It performs the following steps: 1. Makes the path absolute. 2. Evaluates any symbolic links. 3. On case-insensitive OSes (macOS, Windows), converts the path to lowercase.

Types

This section is empty.

Jump to

Keyboard shortcuts

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