config

package
v4.14.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppDir

func AppDir() string

AppDir returns the absolute path to the default BitBox desktop app directory in the user standard config location.

func DownloadsDir

func DownloadsDir() (string, error)

DownloadsDir returns the absolute path to the Downloads folder in the home folder.

func SetAppDir

func SetAppDir(folder string)

SetAppDir sets the app folder (retrieved by AppDir()) and can only be called once.

Types

type File

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

File models a config file in the application's directory. Callers can use AppDir function to obtain the default app config dir.

func NewFile

func NewFile(dir, name string) *File

NewFile creates a new config file with the given name in a directory dir.

func (*File) Exists

func (file *File) Exists() bool

Exists checks whether the file exists with suitable permissions as a file and not as a directory.

func (*File) Path

func (file *File) Path() string

Path returns the absolute path to the config file.

func (*File) ReadJSON

func (file *File) ReadJSON(object interface{}) error

ReadJSON reads the config file as JSON to the given object. Make sure the config file exists!

func (*File) Remove

func (file *File) Remove() error

Remove removes the file.

func (*File) WriteJSON

func (file *File) WriteJSON(object interface{}) error

WriteJSON writes the given object as JSON to the config file.

Jump to

Keyboard shortcuts

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