safefs

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package safefs applies filesystem changes with dry-run support.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckSymlinks(root, srcDirRel, srcSkill string) error

CheckSymlinks rejects symlinks escaping the source directory.

func SameFile

func SameFile(first, second string) bool

SameFile reports whether two paths refer to the same file.

Types

type Applier

type Applier struct {
	// contains filtered or unexported fields
}

Applier writes filesystem changes, honoring dry-run.

func NewApplier

func NewApplier(log *slog.Logger, root string, dryRun bool) (*Applier, error)

NewApplier creates an Applier bound to root.

func (*Applier) Close

func (a *Applier) Close() error

Close releases the root handle.

func (*Applier) CopyDir

func (a *Applier) CopyDir(src, dest, destRel string) error

CopyDir copies src to dest, keeping symlinks as links.

func (*Applier) MkdirAll

func (a *Applier) MkdirAll(destRel string, perm fs.FileMode) error

MkdirAll creates destRel and parents.

func (*Applier) RemoveAll

func (a *Applier) RemoveAll(destRel string) error

RemoveAll removes destRel.

func (*Applier) Within

func (a *Applier) Within(destRel string) error

Within rejects paths escaping the root.

func (*Applier) WriteFile

func (a *Applier) WriteFile(destRel string, data []byte, perm fs.FileMode) error

WriteFile writes data to destRel, creating parents as needed.

Jump to

Keyboard shortcuts

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