pathx

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package pathx expands environment variables and tilde prefixes in paths.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Expand

func Expand(path string) string

Expand resolves environment variables ($VAR, ${VAR}, ${VAR:-default}) and tilde (~, ~/) into a clean, platform-specific path.

func ExpandTilde

func ExpandTilde(path string, getenv func(string) string) string

ExpandTilde resolves a leading tilde (~, ~/) into the user's home directory resolved via HomeDir. Paths without a tilde prefix are returned unchanged, as are tilde paths when the home directory cannot be resolved.

func HomeDir

func HomeDir(getenv func(string) string) string

HomeDir returns the user's home directory: the getenv("HOME") value when non-empty, otherwise os.UserHomeDir, otherwise "" when the home directory cannot be resolved.

Types

This section is empty.

Jump to

Keyboard shortcuts

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