Documentation
¶
Overview ¶
Package pathutil provides shared path manipulation utilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Expand ¶
Expand resolves shell-style tilde expansions in a path:
- "~" → current user's home directory
- "~/subpath" → current user's home directory + subpath
- "~username" → named user's home directory
- "~username/subpath" → named user's home directory + subpath
All other paths are returned unchanged. "." and ".." components are not resolved here; callers should pass the result through filepath.Abs or filepath.Clean as needed.
Note: "~username" lookup uses the OS user database. An error is returned if the named user does not exist.
func MustExpand ¶
MustExpand is like Expand but returns the original path unchanged on error instead of surfacing the error. Useful in contexts where errors are non-fatal (e.g. serving default directories).
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.