locations

package
v3.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package locations implements a type that provides cross-platform access to standard filesystem locations, including config, cache and log directories.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultProvider

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

DefaultProvider is a locations provider using the system-default storage locations.

func NewDefaultProvider

func NewDefaultProvider(name string) (*DefaultProvider, error)

func (*DefaultProvider) UserCache

func (p *DefaultProvider) UserCache() string

UserCache returns a directory that can be used to store user-specific non-essential data. $XDG_CACHE_HOME/protonmail is used on Unix systems; similar on others.

func (*DefaultProvider) UserConfig

func (p *DefaultProvider) UserConfig() string

UserConfig returns a directory that can be used to store user-specific configuration. $XDG_CONFIG_HOME/protonmail is used on Unix systems; similar on others.

func (*DefaultProvider) UserData

func (p *DefaultProvider) UserData() string

UserData returns a directory that can be used to store user-specific data. $XDG_DATA_HOME/protonmail is used on Unix systems; similar on others.

type Locations

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

Locations provides cross-platform access to standard locations. On linux: - settings: ~/.config/protonmail/<app> - gluon ~/.local/share/protonmail/<app>/gluon - logs: ~/.local/share/protonmail/<app>/logs - updates: ~/.local/share/protonmail/<app>/updates - locks: ~/.cache/protonmail/<app>/*.lock Other OSes are similar.

func New

func New(provider Provider, configName string) *Locations

New returns a new locations object.

func (*Locations) CleanGoIMAPCache

func (l *Locations) CleanGoIMAPCache() error

CleanGoIMAPCache removes all cache data from the go-imap implementation.

func (*Locations) Clear

func (l *Locations) Clear(except ...string) error

Clear removes everything except the lock and update files.

func (*Locations) ClearUpdates

func (l *Locations) ClearUpdates() error

ClearUpdates removes update files.

func (l *Locations) GetDependencyLicensesLink() string

GetDependencyLicensesLink returns link to page listing dependencies.

func (*Locations) GetGuiLockFile

func (l *Locations) GetGuiLockFile() string

GetGuiLockFile returns the path to the GUI lock file (e.g. ~/.cache/<company>/<app>/<app>.lock).

func (*Locations) GetLicenseFilePath

func (l *Locations) GetLicenseFilePath() string

GetLicenseFilePath returns path to liense file.

func (*Locations) GetLockFile

func (l *Locations) GetLockFile() string

GetLockFile returns the path to the bridge lock file (e.g. ~/.cache/<company>/<app>/<app>.lock).

func (*Locations) ProvideGUICertPath

func (l *Locations) ProvideGUICertPath() (string, error)

ProvideGUICertPath returns a location for TLS certs used for the connection between bridge and the GUI. It creates it if it doesn't already exist.

func (*Locations) ProvideGluonCachePath added in v3.0.12

func (l *Locations) ProvideGluonCachePath() (string, error)

ProvideGluonCachePath returns a location for gluon data. It creates it if it doesn't already exist.

func (*Locations) ProvideGluonDataPath added in v3.0.12

func (l *Locations) ProvideGluonDataPath() (string, error)

ProvideGluonDataPath returns a location for gluon data. It creates it if it doesn't already exist.

func (*Locations) ProvideIMAPSyncConfigPath added in v3.5.0

func (l *Locations) ProvideIMAPSyncConfigPath() (string, error)

func (*Locations) ProvideLogsPath

func (l *Locations) ProvideLogsPath() (string, error)

ProvideLogsPath returns a location for user logs (e.g. ~/.local/share/<company>/<app>/logs). It creates it if it doesn't already exist.

func (*Locations) ProvideSettingsPath

func (l *Locations) ProvideSettingsPath() (string, error)

ProvideSettingsPath returns a location for user settings (e.g. ~/.config/<company>/<app>). It creates it if it doesn't already exist.

func (*Locations) ProvideStatsPath added in v3.3.1

func (l *Locations) ProvideStatsPath() (string, error)

ProvideStatsPath returns a location for statistics files (e.g. ~/.local/share/<company>/<app>/stats). It creates it if it doesn't already exist.

func (*Locations) ProvideUpdatesPath

func (l *Locations) ProvideUpdatesPath() (string, error)

ProvideUpdatesPath returns a location for update files (e.g. ~/.local/share/<company>/<app>/updates). It creates it if it doesn't already exist.

type Provider

type Provider interface {
	UserConfig() string
	UserData() string
	UserCache() string
}

Provider provides standard locations.

Jump to

Keyboard shortcuts

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