Skip to content

Commit

Permalink
better config.json recovery, close #221
Browse files Browse the repository at this point in the history
  • Loading branch information
juzeon committed Feb 17, 2024
1 parent e0fe492 commit 8e835df
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ debug.bat
config.lock
debug_options_sets.json
dump.txt
config.json.old
2 changes: 2 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,12 @@ WriterFor:
if err != nil {
util.GracefulPanic(err)
}
_ = os.Rename("config.json", "config.json.old")
err = os.WriteFile("config.json", v, 0644)
if err != nil {
util.GracefulPanic(err)
}
_ = os.Remove("config.json.old")
localVersion = o.version
}
o.mu.RUnlock()
Expand Down

0 comments on commit 8e835df

Please sign in to comment.