pathutil

package
v0.16.7 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package pathutil resolves filesystem aliases across platforms.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Resolve

func Resolve(path string) (string, error)

Resolve returns the absolute path of an existing file or directory, following symbolic links and Windows junctions. It does not grant access to that path; callers must still enforce their filesystem boundaries when opening it.

func ResolveExistingPrefix added in v0.16.7

func ResolveExistingPrefix(path string) (string, error)

ResolveExistingPrefix resolves links in the longest existing prefix and appends any missing components. This lets callers check containment before creating an output path. Dangling links are errors, including junctions whose targets no longer exist; they must not be treated as missing directories.

func WalkDir added in v0.16.7

func WalkDir(root string, visit fs.WalkDirFunc) error

WalkDir follows links in the selected root, including Windows junctions, while preserving the caller's path spelling in callbacks. Like filepath.WalkDir, it does not follow links encountered beneath the root. Directory reads are anchored to an os.Root so a directory replaced by a link during the walk cannot redirect traversal outside the selected root.

Types

This section is empty.

Jump to

Keyboard shortcuts

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