Documentation
¶
Overview ¶
Package fsutil holds small filesystem helpers shared across sqi.
AppleDouble files ¶
macOS stores a file's extended attributes and resource fork in a companion file named "._<original>" whenever the underlying filesystem cannot hold them natively — exFAT, FAT32, SMB and NFS shares, and most USB media. A checkout on such a volume therefore sprouts a "._foo.yaml" beside every "foo.yaml".
Those companions are binary, carry no content sqi cares about, and — because they keep the original extension — are matched by every "*.yaml" glob and every `strings.HasSuffix(name, ".yaml")` filter. Code that scans a directory then tries to parse one and fails on a control character, reporting a corrupt file that does not exist. This has bitten this repository more than once, in unrelated subsystems, which is why the guard lives in one place.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterDirEntries ¶
FilterDirEntries returns entries with AppleDouble companions removed, preserving order. It is the guard for os.ReadDir and fs.ReadDir results.
func FilterPaths ¶
FilterPaths returns paths with AppleDouble companions removed, preserving order. It is the guard for filepath.Glob results, which match "._x.yaml" against "*.yaml" like any other file.
func Glob ¶
Glob is filepath.Glob with AppleDouble companions removed. A "*.yaml" pattern matches "._foo.yaml" like any other file, so every caller globbing for data files wants this rather than the stdlib version.
func HideAppleDouble ¶
HideAppleDouble wraps an fs.FS so AppleDouble companions are invisible to both directory listings and Open calls. Use it when a package hands an fs.FS to code it does not control.
func IsAppleDouble ¶
IsAppleDouble reports whether a path's base name marks it as a macOS AppleDouble companion file. It accepts a bare name or a full path.
Both separators are recognized on every platform: filepath.Base only splits on the host's separator, so a Windows-style path checked on Linux would otherwise be treated as one long base name and slip through.
Types ¶
This section is empty.