mirror of
https://github.com/Monibuca/engine.git
synced 2025-10-17 22:21:46 +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() {
|
opt.saveTimer = time.AfterFunc(time.Second, func() {
|
||||||
lock.Lock()
|
lock.Lock()
|
||||||
defer lock.Unlock()
|
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 {
|
if err == nil {
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
err = yaml.NewEncoder(file).Encode(opt.Modified)
|
err = yaml.NewEncoder(file).Encode(opt.Modified)
|
||||||
|
Reference in New Issue
Block a user