mirror of
https://github.com/Monibuca/engine.git
synced 2025-10-16 21:51:25 +08:00
Update plugin.go
配置信息保存的时候需要使用os.O_TRUNC 模式, 否则只会覆盖前面的字符
This commit is contained in:
@@ -188,7 +188,7 @@ func (opt *Plugin) Save() error {
|
||||
opt.saveTimer = time.AfterFunc(time.Second, func() {
|
||||
lock.Lock()
|
||||
defer lock.Unlock()
|
||||
file, err := os.OpenFile(opt.settingPath(), os.O_CREATE|os.O_WRONLY, 0644)
|
||||
file, err := os.OpenFile(opt.settingPath(), os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0644)
|
||||
if err == nil {
|
||||
defer file.Close()
|
||||
err = yaml.NewEncoder(file).Encode(opt.Modified)
|
||||
|
Reference in New Issue
Block a user