fix update config file error

This commit is contained in:
tickstep
2026-04-12 08:32:26 +08:00
parent 42f044ba38
commit e20ea479c4
+10 -2
View File
@@ -375,7 +375,8 @@ func CheckUpdate(version string, yes bool) {
return return
} }
execPath := cmdutil.ExecutablePath() //execPath := cmdutil.ExecutablePath()
configPath := configurationPath()
var fileNum, errTimes int var fileNum, errTimes int
for _, zipFile := range reader.File { for _, zipFile := range reader.File {
@@ -399,9 +400,11 @@ func CheckUpdate(version string, yes bool) {
name := zipFile.Name[strings.Index(zipFile.Name, "/")+1:] name := zipFile.Name[strings.Index(zipFile.Name, "/")+1:]
if name == ReleaseName { if name == ReleaseName {
// 执行文件
err = update(cmdutil.Executable(), rc) err = update(cmdutil.Executable(), rc)
} else { } else {
err = update(filepath.Join(execPath, name), rc) // 配置文件
err = update(filepath.Join(configPath, name), rc)
} }
if err != nil { if err != nil {
@@ -418,3 +421,8 @@ func CheckUpdate(version string, yes bool) {
fmt.Printf("更新完毕, 请重启程序\n") fmt.Printf("更新完毕, 请重启程序\n")
} }
// ConfigurationPath 获取程序配置所在目录
func configurationPath() string {
return config.GetConfigDir()
}