mirror of
https://github.com/Jguer/yay
synced 2024-08-31 05:39:29 +00:00
fix(config): fix save config
This commit is contained in:
parent
497f94ca9f
commit
6beefb1400
3
main.go
3
main.go
|
@ -99,8 +99,7 @@ func main() {
|
|||
}
|
||||
|
||||
if config.Runtime.SaveConfig {
|
||||
errS := config.Save(config.Runtime.ConfigPath)
|
||||
if errS != nil {
|
||||
if errS := config.Save(config.Runtime.ConfigPath); errS != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,10 +83,8 @@ func (c *Configuration) Save(configPath string) error {
|
|||
// https://github.com/Jguer/yay/issues/1325
|
||||
marshalledinfo = append(marshalledinfo, '\n')
|
||||
// https://github.com/Jguer/yay/issues/1399
|
||||
// fix: unsaved config when yay's config path does not exist
|
||||
_, err = os.Stat(filepath.Dir(configPath))
|
||||
if os.IsNotExist(err) && err != nil {
|
||||
if mkErr := os.MkdirAll(filepath.Dir(configPath), 0761); mkErr != nil {
|
||||
if _, err = os.Stat(filepath.Dir(configPath)); os.IsNotExist(err) && err != nil {
|
||||
if mkErr := os.MkdirAll(filepath.Dir(configPath), 0o755); mkErr != nil {
|
||||
return mkErr
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue