Documentation
¶
Overview ¶
File system steps every part of icebath takes the same way: lock files, whole file writes, copies, and the questions asked of a path
Index ¶
- Variables
- func Below(path, root string) bool
- func CloseAll(files ...*os.File)
- func Copy(src, dst string) error
- func CopyTree(files fs.FS, dest string, skip func(name string) bool) error
- func Digest(path string) (string, error)
- func Disk(path string) (free, total int64, ok bool)
- func Elevated() bool
- func Executable(path string) bool
- func Exists(path string) bool
- func Expand(path, home string) string
- func ExpandFrom(path string, getenv func(name string) string) string
- func ExpandHome(path string) string
- func Give(string) error
- func Held(err error) bool
- func Inside(path, root string) bool
- func IsDir(path string) bool
- func IsFile(path string) bool
- func Lexists(path string) bool
- func Lock(ctx context.Context, path string, timeout time.Duration) (release func(), err error)
- func MakeUserDir(path string, mode os.FileMode) error
- func Mentioned(words string, endings ...string) []string
- func OpenLocked(path string, wait bool) (*os.File, bool, error)
- func Remedy(path string) string
- func Replace(path string, data []byte, perm os.FileMode) error
- func Resolved(path string) string
- func Retry(operation func() error) error
- func Sweep(dir string, age time.Duration)
- func Tilde(path string) string
- func TreeDigest(files fs.FS, skip func(name string) bool) (string, error)
- func TryLock(path string) (release func(), ok bool, err error)
- func Within(path, root string) bool
- func Write(path string, data []byte, perm os.FileMode) error
- func Written(path string) string
- type Grant
- type Mention
- type Repair
- type Seen
- type Skip
- type TimeoutError
Constants ¶
This section is empty.
Variables ¶
var ErrNotElevated = errors.New("This needs icebath run as administrator, as the administrators hold what is to be given back.")
Why a process that is not elevated could not repair what the administrators of Windows hold
Functions ¶
func CloseAll ¶
Closes every file, what a close says left unsaid, as the ends of pipes a started child no longer needs
func CopyTree ¶
Copies the folders and regular files of a tree into dest, made when missing, an executable file staying executable; the names skip says yes to are left out with what they hold, and a link is refused since it could lead out of dest. skip sees slash paths from the root and may be nil
func Disk ¶
Bytes this user may still store on the volume of the path and the size of the volume; false when the volume tells nothing
func Elevated ¶
func Elevated() bool
Whether this process runs elevated, which only Windows tells apart from running as its user: never here
func Executable ¶
Whether the path is a regular file this process may run, through links
func Expand ¶
Path with a leading ~ standing for the home folder given expanded, such as the HOME a profile or a child process is handed; left as it is when home is empty
func ExpandFrom ¶
Path with a leading ~ standing for the home folder the HOME of an environment names expanded, such as a path a variable of a profile holds, the user's own when it names none
func ExpandHome ¶
Path with a leading ~ standing for the user's home folder expanded, left as it is when there is no home
func Give ¶
Gives the entry back to the user of this process, which only an elevated run of Windows takes away: nothing here
func Inside ¶
Whether the path is the root or lies under it once the links of both are followed as far as they are there, so neither .. nor a link leads out of it
func Lock ¶
Takes the advisory lock of the lock file at path, made with its folder when missing, waiting while another process or handle holds it until ctx is done or the timeout passes: a zero timeout tries once, a negative one waits for as long as it takes
func MakeUserDir ¶
Makes the folder and those missing above it with the mode, which belong to the user of this process here
func Mentioned ¶
Paths of this computer the words name outside their blocks and spans of code, each once in the order named, cleaned and a leading ~ written out: whole from the root, the home folder or a drive, the name ending in one of the endings in any case, such as png or tar.gz. A path inside a word, an address or another path is none; none for no endings
func OpenLocked ¶
Opens the file at path, made with its folder when missing, holding its advisory lock until the file is closed: waiting for the lock when wait is true, else false while another process or handle holds it. For a lock file that keeps data of its own, which TryLock and Lock would overwrite
func Remedy ¶
What a person runs to have a folder this process may not use back: on Windows the inherited access list put back from an administrator's prompt, elsewhere the folder given to them
func Resolved ¶
Path made whole against the working folder, cleaned, with the links of the part of it that is there followed and the rest of it as it is, so a file about to be made, or gone, is named where it is or was, and a .. after a link leads where the system leads it
func Retry ¶
Runs a rename or removal again for about three seconds while another program, usually an antivirus scan on Windows, holds the file
func Sweep ¶
Removes what the folder holds that was last changed longer ago than the age, files and folders alike; nothing for a folder that is not there
func Tilde ¶
Path as a person reads it, the user's home folder at its start written ~, the path cleaned and left as it is outside the home folder
func TreeDigest ¶
Digest of the files of a tree: each file's path from the root and the digest of its bytes, in path order, so no bytes moved from one file to the next read the same; the names skip says yes to left out with what they hold. skip sees slash paths from the root and may be nil
func TryLock ¶
Takes the advisory lock of the lock file at path, made with its folder when missing and never opened through a link, without waiting: its release, or false while another process or handle holds it. The file itself is never removed, so a process waiting on it never holds the lock of a file gone from its folder
Types ¶
type Grant ¶
One grant of the repair: the user of this process given full control of the entry, inherited by what is in it for a folder. Bounded says a link lies somewhere below the folder, so the grant must not be carried down the tree by the system, as icacls carries it
type Mention ¶
type Mention struct {
// The path cleaned with a leading ~ written out, and as the words have it, which is what the words hold from Start up to End
Path, Named string
Start, End int
}
One place words name a path of this computer, as Mentions finds it
type Repair ¶
What a repair of a tree would change, or changed: the grants, the entries left and why, how many already were the user's, and once made, how many grants took and those that failed
func Plan ¶
Plans the repair of the tree at the root, whose own place the system names real, from what was seen of its entries: each entry the user lacks full control of is granted it, a folder's grant inherited by what comes to be in it; nothing is granted to or through a link, a junction or another reparse point, to anything below one, to a file with other names, or to an entry the system places elsewhere than the tree. A folder holding any of those below it is granted on its own alone. Folders come before what is in them
func RepairTree ¶
Repairs the access to a tree an elevated run of Windows took, which no run here takes: nothing to do
type Seen ¶
type Seen struct {
Path string
// It is a folder; it is a link, a junction or another reparse point, which the repair never grants through
Dir, Reparse bool
// Names a file has, more than one for a file linked under other names that may be outside the tree
Names int
// Where the system says the entry is once every link on its way is followed, empty when not told; one placed elsewhere than its own
// place below the root is no part of the tree
Final string
// The user of this process may already do anything with it, and for a folder so may with what comes to be in it
Granted bool
// Why it could not be looked at, empty when it could; such an entry is granted, its look made again as the grant opens it
Problem string
}
What the repair of a folder an elevated process left to the administrators sees of one entry of the folder's tree
type TimeoutError ¶
Lock wait that gave up once its timeout passed, with the pid another live process stamped in the lock file, zero when unknown
func (*TimeoutError) Error ¶
func (e *TimeoutError) Error() string
func (*TimeoutError) Unwrap ¶
func (e *TimeoutError) Unwrap() error
Lets errors.Is match os.ErrDeadlineExceeded