Documentation ¶
Overview ¶
Package locations implements a type that provides cross-platform access to standard filesystem locations, including config, cache and log directories.
Index ¶
- type DefaultProvider
- type Locations
- func (l *Locations) Clean() error
- func (l *Locations) Clear() error
- func (l *Locations) ClearUpdates() error
- func (l *Locations) GetLicenseFilePath() string
- func (l *Locations) GetLockFile() string
- func (l *Locations) GetOldCachePath() string
- func (l *Locations) GetOldUpdatesPath() string
- func (l *Locations) GetUpdatesPath() string
- func (l *Locations) ProvideCachePath() (string, error)
- func (l *Locations) ProvideLogsPath() (string, error)
- func (l *Locations) ProvideSettingsPath() (string, error)
- func (l *Locations) ProvideUpdatesPath() (string, error)
- type Provider
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
func (*DefaultProvider) UserConfig ¶
func (p *DefaultProvider) UserConfig() string
type Locations ¶
type Locations struct {
// contains filtered or unexported fields
}
Locations provides cross-platform access to standard locations. On linux: - settings: ~/.config/protonmail/<app> - logs: ~/.cache/protonmail/<app>/logs - cache: ~/.config/protonmail/<app>/cache - updates: ~/.config/protonmail/<app>/updates - lockfile: ~/.cache/protonmail/<app>/<app>.lock .
func (*Locations) Clean ¶
Clean removes any unexpected files from the app cache folder while leaving files in the standard locations untouched.
func (*Locations) ClearUpdates ¶
ClearUpdates removes update files.
func (*Locations) GetLicenseFilePath ¶
GetLicenseFilePath returns path to liense file.
func (*Locations) GetLockFile ¶
GetLockFile returns the path to the lock file (e.g. ~/.cache/<company>/<app>/<app>.lock).
func (*Locations) GetOldCachePath ¶ added in v1.7.0
GetOldCachePath returns a former location for user cache dirs used for migration scripts only.
func (*Locations) GetOldUpdatesPath ¶ added in v1.7.0
GetOldUpdatesPath returns a former location for update files used for migration scripts only.
func (*Locations) GetUpdatesPath ¶ added in v1.7.0
GetUpdatesPath returns a new location for update files used for migration scripts only.
func (*Locations) ProvideCachePath ¶
ProvideCachePath returns a location for user cache dirs (e.g. ~/.config/<company>/<app>/cache). It creates it if it doesn't already exist.
func (*Locations) ProvideLogsPath ¶
ProvideLogsPath returns a location for user logs (e.g. ~/.cache/<company>/<app>/logs). It creates it if it doesn't already exist.
func (*Locations) ProvideSettingsPath ¶
ProvideSettingsPath returns a location for user settings (e.g. ~/.config/<company>/<app>). It creates it if it doesn't already exist.
func (*Locations) ProvideUpdatesPath ¶
ProvideUpdatesPath returns a location for update files (e.g. ~/.cache/<company>/<app>/updates). It creates it if it doesn't already exist.