Documentation
¶
Overview ¶
Package store resolves the nt data directory ($NT_DIR) and the paths of the files within it. The store is global by design (SPEC §2): one directory, always available regardless of the current working directory.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadFile ¶
ReadFile reads a file, returning empty bytes (not an error) when it does not exist yet — tasks.txt may legitimately be absent on a fresh store.
func ResolveDir ¶ added in v0.4.0
ResolveDir returns the store directory ($NT_DIR, else $XDG_DATA_HOME/nt, else ~/.local/share/nt) WITHOUT creating it — for callers (config, web) that need the path before, or without, opening the store.
func WriteAtomic ¶
WriteAtomic writes data to path atomically: it writes a temp file in the same directory (so rename stays on one filesystem) then renames over the target. On POSIX, rename(2) is atomic, so a reader never sees a half-written file (SPEC §6.1).
Types ¶
type Store ¶
type Store struct {
Dir string
}
Store is a handle to a resolved nt data directory.
func Open ¶
Open resolves the store directory and ensures it (and notes/) exist.
Resolution order:
- $NT_DIR if set
- $XDG_DATA_HOME/nt
- ~/.local/share/nt