add DefaultSavePath config

This commit is contained in:
Reto Brunner 2019-06-25 09:23:51 +02:00 committed by Drew DeVault
parent 61c94e54cd
commit ee242a3d0f

View file

@ -18,6 +18,10 @@ import (
"github.com/kyoh86/xdg"
)
type GeneralConfig struct {
DefaultSavePath string `ini:"default-save-path"`
}
type UIConfig struct {
IndexFormat string `ini:"index-format"`
TimestampFormat string `ini:"timestamp-format"`
@ -85,6 +89,7 @@ type AercConfig struct {
Filters []FilterConfig `ini:"-"`
Viewer ViewerConfig `ini:"-"`
Ui UIConfig
General GeneralConfig
}
// Input: TimestampFormat
@ -319,6 +324,11 @@ func LoadConfig(root *string, sharedir string) (*AercConfig, error) {
return nil, err
}
}
if ui, err := file.GetSection("general"); err == nil {
if err := ui.MapTo(&config.General); err != nil {
return nil, err
}
}
accountsPath := path.Join(*root, "accounts.conf")
if accounts, err := loadAccountConfig(accountsPath); err != nil {
return nil, err