fsutil

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func FilterDirEntries(entries []fs.DirEntry) []fs.DirEntry

FilterDirEntries returns entries with AppleDouble companions removed, preserving order. It is the guard for os.ReadDir and fs.ReadDir results.

func FilterPaths

func FilterPaths(paths []string) []string

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

func Glob(pattern string) ([]string, error)

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

func HideAppleDouble(inner fs.FS) fs.FS

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

func IsAppleDouble(name string) bool

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.

Jump to

Keyboard shortcuts

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