Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDirectoryOfFile ¶
GetDirectoryOfFile returns the directory containing the given file path
func ValidatePathWithinBase ¶
ValidatePathWithinBase checks if targetPath is within baseDir (no path traversal escape) This is optional validation for security-sensitive operations Pass empty baseDir to skip validation
Types ¶
type PathExpander ¶
type PathExpander struct {
// contains filtered or unexported fields
}
PathExpander provides path expansion functionality
func NewPathExpander ¶
func NewPathExpander(renderer template.Renderer) *PathExpander
NewPathExpander creates a new PathExpander with the given template renderer
func (*PathExpander) ExpandPath ¶
func (p *PathExpander) ExpandPath(originalPath string, currentDir string, context map[string]interface{}) (string, error)
ExpandPath expands a path with template variables and special prefixes (~, ., ./)
func (*PathExpander) SafeExpandPath ¶
func (p *PathExpander) SafeExpandPath(originalPath string, currentDir string, context map[string]interface{}, baseDir string) (string, error)
SafeExpandPath is like ExpandPath but validates the result is within baseDir Pass empty baseDir to disable validation (same as ExpandPath)
Click to show internal directories.
Click to hide internal directories.