Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Commit

Permalink
fix config readerr
Browse files Browse the repository at this point in the history
  • Loading branch information
boypt committed Dec 23, 2019
1 parent 3cd2872 commit e1f81c1
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions engine/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"io/ioutil"
"log"
"os"
"reflect"
"strings"

Expand Down Expand Up @@ -105,11 +106,13 @@ func (c *Config) SaveConfigFile(configPath string) error {

ob, err := ioutil.ReadFile(configPath)
if err != nil {
return err
}

if bytes.Compare(b, ob) == 0 {
return nil
if !os.IsNotExist(err) {
return err
}
} else {
if bytes.Compare(b, ob) == 0 {
return nil
}
}

return ioutil.WriteFile(configPath, b, 0644)
Expand Down

0 comments on commit e1f81c1

Please sign in to comment.