paths

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir(override string) (string, error)

ConfigDir returns the directory for cloudstic configuration and state files. Resolution order:

  1. override, when non-empty (the -config-dir flag)
  2. CLOUDSTIC_CONFIG_DIR environment variable
  3. os.UserConfigDir()/cloudstic (platform default)

Resolution performs no filesystem access. The directory is created, with 0700 permissions, by whoever writes into it — SaveAtomic and profile.Save both do — so asking where configuration *would* live never creates it. That matters because the answer is needed on paths that must not have side effects: rendering help, generating completions, and previewing a setup with -dry-run all resolve this path without any intent to write.

func MachineID added in v1.14.0

func MachineID() string

MachineID returns a unique identifier for the current machine. It tries to read from common system files.

func SaveAtomic added in v1.14.0

func SaveAtomic(path string, data []byte) error

SaveAtomic writes data to a temporary file in the target directory and atomically renames it to path to prevent file corruption during crashes. It ensures 0600 permissions on the final file.

func TokenPath

func TokenPath(override, filename string) (string, error)

TokenPath returns the full path for a token file stored inside the config directory (e.g. "google_token.json" → "~/.config/cloudstic/google_token.json"). override has ConfigDir's meaning.

Types

This section is empty.

Jump to

Keyboard shortcuts

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