directory

package
v0.0.0-...-5f133c6 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: BSD-3-Clause, BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Config loaders to read/write files in directories.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigDir

func GetConfigDir(app string, namespaces ...string) (string, error)

Returns the absolute path to a specific folder within the system default configuration directory for the current user.

On Linux systems, this generally means ~/.config/<app>/<namespace>

func Refresh

func Refresh()

Refresh values cached by OpenHomeDir.

Internally, OpenHomeDir caches some of the computed paths. Refresh() will cause those paths to be re-computed.

Don't bother calling Refresh() unless your project mingles with the HOME environment variable, or variables like XDG_CONFIG_HOME.

Types

type Directory

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

func OpenDir

func OpenDir(base string, sub ...string) (*Directory, error)

OpenDir returns a Loader capable of loading and creating config files in the specified directory.

func OpenHomeDir

func OpenHomeDir(app string, namespaces ...string) (*Directory, error)

OpenHomeDir returns a Loader capable of loading and creating config files in the system default configuration directory for the current user.

On Linux systems, this generally means ~/.config/<app>/<namespace>/.

func (*Directory) Delete

func (hd *Directory) Delete(name string) error

func (*Directory) List

func (hd *Directory) List() ([]string, error)

func (*Directory) Read

func (hd *Directory) Read(name string) ([]byte, error)

func (*Directory) Write

func (hd *Directory) Write(name string, data []byte) error

Jump to

Keyboard shortcuts

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