settings

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2019 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package settings defines the app settings and functions to save and load those.

Index

Constants

This section is empty.

Variables

View Source
var Defaults = defaultSettings()

Defaults stores default values for settings

Functions

func CoreForPlaylist

func CoreForPlaylist(playlist string) (string, error)

CoreForPlaylist returns the absolute path of the default libretro core for a given playlist

func Load

func Load() error

Load loads settings from the home directory. If the settings file doesn't exists, it will return an error and set all the settings to their default value.

func Save

func Save() error

Save saves the current configuration to the home directory

Types

type Settings

type Settings struct {
	VideoFullscreen      bool              `json:"video_fullscreen" label:"Video Fullscreen" fmt:"%t" widget:"switch"`
	VideoMonitorIndex    int               `json:"video_monitor_index" label:"Video Monitor Index" fmt:"%d"`
	GLVersion            string            `json:"video_gl_version"`
	AudioVolume          float32           `json:"audio_volume" label:"Audio Volume" fmt:"%.1f" widget:"range"`
	ShowHiddenFiles      bool              `json:"menu_showhiddenfiles" label:"Show Hidden Files" fmt:"%t" widget:"switch"`
	CoreForPlaylist      map[string]string `json:"core_for_playlist"`
	CoresDirectory       string            `json:"cores_dir" label:"Cores Directory" fmt:"%s" widget:"dir"`
	AssetsDirectory      string            `json:"assets_dir" label:"Assets Directory" fmt:"%s" widget:"dir"`
	DatabaseDirectory    string            `json:"database_dir" label:"Database Directory" fmt:"%s" widget:"dir"`
	SavestatesDirectory  string            `json:"savestates_dir" label:"Savestates Directory" fmt:"%s" widget:"dir"`
	SavefilesDirectory   string            `json:"savefiles_dir" label:"Savefiles Directory" fmt:"%s" widget:"dir"`
	ScreenshotsDirectory string            `json:"screenshots_dir" label:"Screenshots Directory" fmt:"%s" widget:"dir"`
	SystemDirectory      string            `json:"system_dir" label:"System Directory" fmt:"%s" widget:"dir"`
	PlaylistsDirectory   string            `json:"playlists_dir" label:"Playlists Directory" fmt:"%s" widget:"dir"`
	ThumbnailsDirectory  string            `json:"thumbnail_dir" label:"Thumbnails Directory" fmt:"%s" widget:"dir"`
}

Settings is the list of available settings for the program. It serializes to JSON. Tags are used to set a human readable label and a format for the settings value. Widget sets the graphical representation of the value.

var Current Settings

Current stores the current settings at runtime

Jump to

Keyboard shortcuts

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