userconfig

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 7 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.

README

Shared user storage root

RootDir() resolves $XDG_CONFIG_HOME on macOS and Linux, or ~/.config when the variable is empty. An explicit XDG root must be absolute. Invalid or relative values fail; they are never interpreted relative to the current directory and never trigger another storage fallback. Windows retains os.UserConfigDir() (%AppData%); XDG settings do not override the Windows native location.

AppDir() appends nb1. Both functions only resolve strings. They create no directories, inspect no USB devices and migrate no files. The same resolver is used for the current configuration, its default library, and the Linux user-service configuration root. The Linux installer pins its verified root in the child process environment.

The fixed native LaunchAgent and service-management coordination locations are OS integration state; they are not moved by this resolver. Only the established setting.yaml lookup remains a legacy application configuration fallback. No recent experimental storage location is an alias for this root.

NativeAppDir() retains os.UserConfigDir()/nb1 for persistent device ownership coordination. On macOS the lock directory therefore stays at ~/Library/Application Support/nb1/device-locks, even though user configuration and the default library now use XDG storage. Existing executables and new candidates continue to contend on the same default lock. On Linux the native root already follows XDG; on Windows it remains %AppData%.

Changing --config never relocates locks. Explicit NB1_LOCK_DIR/--lock-dir still requires every controller of the same device to use the same directory. Do not remove lock files or move directories while an owner is alive. This code performs no automatic old-root probing, dual-lock acquisition, migration or service restart.

Documentation

Overview

Package userconfig resolves per-user application storage without touching the filesystem. User configuration and native OS coordination have explicit, separate policies so changing a profile location cannot split ownership locks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppDir

func AppDir() (string, error)

AppDir returns nb1's shared configuration and library root. It creates nothing and does not inspect or migrate older storage locations.

func NativeAppDir

func NativeAppDir() (string, error)

NativeAppDir retains nb1's established native OS coordination root. Device locks must keep this location while older controllers may still own a handle. On macOS it is distinct from AppDir, even with XDG_CONFIG_HOME configured.

func RootDir

func RootDir() (string, error)

RootDir returns the configuration parent directory. On macOS and Linux it is XDG_CONFIG_HOME, or ~/.config when that variable is empty. Windows retains os.UserConfigDir's native location. Relative roots are rejected, never made absolute against the current working directory.

Types

This section is empty.

Jump to

Keyboard shortcuts

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