xdg

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT 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 xdg resolves the files fft keeps on disk to the XDG base directory they belong in: $XDG_<KIND>_HOME/fft/<name>, else the conventional directory under the user's home.

Which base a file belongs to is a decision about the file, not about this package: the config is something the user edits, the update cache is something fft can rebuild by asking again, credentials and history are state, and templates and components are data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

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

Base is one XDG base directory: the variable that overrides it and the directory under the home it falls back to.

The bases fft uses are handed out by functions rather than kept in exported variables, so that no importer can reassign one and move, say, the credentials file for the whole process.

func Cache

func Cache() Base

Cache is $XDG_CACHE_HOME, else ~/.cache.

func Config

func Config() Base

Config is $XDG_CONFIG_HOME, else ~/.config.

func Data

func Data() Base

Data is $XDG_DATA_HOME, else ~/.local/share.

func State

func State() Base

State is $XDG_STATE_HOME, else ~/.local/state.

func (Base) LookupPath

func (b Base) LookupPath(lookup func(string) (string, bool), name string) (string, error)

LookupPath is Base.Path reading b's variable through lookup, os.LookupEnv when nil, and trimming it first: a variable holding only whitespace counts as unset.

func (Base) Path

func (b Base) Path(name string) (string, error)

Path is name inside fft's directory under b, reading b's variable from the environment. A variable set to the empty string counts as unset.

Jump to

Keyboard shortcuts

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