settings

package
v0.0.0-...-ad213d4 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package settings provides functionality for creating and managing the application's settings.

Index

Constants

View Source
const (
	FileExtension = ".grundy.ini"
	ExampleSuffix = "-example"
)

Variables

View Source
var (
	GameImageSuffixes = append(gameIconSuffixes, gameGridImageSuffixes...)
)

Functions

func Create

func Create(parentDirPath string, filenameSuffix string, s SaveableSettings) error

func CreateDir

func CreateDir(dirPath string) error

func CreateInternalFilesDir

func CreateInternalFilesDir(settingsDirPath string) (string, error)

func CreateLogFilesDir

func CreateLogFilesDir(settingsDirPath string) (string, error)

func DirPath

func DirPath() string

func InternalFilesDir

func InternalFilesDir(settingsDirPath string) string

func LogFile

func LogFile(settingsDirPath string) (*os.File, error)

Types

type AppSettings

type AppSettings interface {
	SaveableSettings
	GameCollectionsPathsToLauncherNames() map[string]string
	AddGameCollection(dirPath string, launcherName string)
	RemoveGameCollection(dirPath string)
	HasGameCollection(dirPath string) (launcherName string, ok bool)
}

func NewAppSettings

func NewAppSettings() AppSettings

type DynamicFilePath

type DynamicFilePath interface {
	FilePath() string
	WasDynamicallySelected() bool
	FileExists() bool
}

type GameSettings

type GameSettings interface {
	SaveableSettings
	SetName(string)
	Name() string
	SetExeSubPath(string)
	ExeFullPath(launcher Launcher) (filePath string, exists bool)
	ShouldOverrideLauncherArgs() bool
	SetLauncherOverrideArgs(string)
	LauncherOverrideArgs() string
	SetAdditionalLauncherArgs(string)
	AdditionalLauncherArgs() string
	SetIconPath(string)
	IconPath() DynamicFilePath
	SetGridImagePath(string)
	GridImagePath() DynamicFilePath
	AddCategory(string)
	RemoveCategory(string)
	SetCategories([]string)
	Categories() []string
}

func LoadGameSettings

func LoadGameSettings(filePath string, launcher Launcher) (GameSettings, error)

func NewGameSettings

func NewGameSettings(dirPath string) GameSettings

type KnownGamesSettings

type KnownGamesSettings interface {
	SaveableSettings
	GameDirPathsToGameNames() map[string]string
	AddUniqueGameOnly(game GameSettings, gameDirPath string) bool
	Disown(gameDirPath string) (gameName string, ok bool)
	DisownNonExistingGames() (gameDirPathsToGameNames map[string]string)
}

func LoadOrCreateKnownGamesSettings

func LoadOrCreateKnownGamesSettings(parentDirPath string) (KnownGamesSettings, bool)

type Launcher

type Launcher interface {
	ResetToDefaults()
	Example() Launcher
	IsValid() error
	SetName(string)
	Name() string
	SetExePath(string)
	ExePath() string
	ExeDirPath() string
	SetDefaultArgs(string)
	DefaultArgs() string
	SetGameFileSuffixes([]string)
	GameFileSuffixes() []string
}

func NewLauncher

func NewLauncher() Launcher

type LaunchersSettings

type LaunchersSettings interface {
	SaveableSettings
	Has(name string) (Launcher, bool)
	AddOrUpdate(Launcher)
	Remove(Launcher)
}

func NewLaunchersSettings

func NewLaunchersSettings() LaunchersSettings

type SaveableSettings

type SaveableSettings interface {
	Filename(additionalSuffix string) string
	Reload(filePath string) error
	Save(io.Writer) error
	ResetToDefaults()
	Example() SaveableSettings
}

Jump to

Keyboard shortcuts

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