feat(版本管理): 统一版本与资源文件命名

This commit is contained in:
xiaoqidun committed 2026-10-10 22:07:14 +08:00
1 parent e6a8786f0c
commit d181d9edca
2 files changed
+4 -9

No files matched your search

+2 -4
View File
@@ -24,7 +24,6 @@ import (
"path"
"slices"
"strconv"
"strings"
)
// DocumentVersions 获取当前编辑文档的版本信息,包含尚未写出的修改
@@ -117,7 +116,7 @@ func (e *Editor) AddVersion(name string) (string, error) {
return 0, err
}
body := root.childAt("DocBody", reader.documentIndex)
location := packageAvailableName(reader, nil, path.Join(path.Dir(entry), "Versions", id+".xml"))
location := packageAvailableName(reader, nil, path.Join(path.Dir(entry), "Versions", "Version_"+strconv.FormatInt(int64(index), 10)+".xml"))
attrs := ofdAttrs{{Name: xml.Name{Local: "ID"}, Value: id}}
format := reader.Version()
if reader.versionInfo != nil && reader.versionInfo.Version != "" {
@@ -250,8 +249,7 @@ func (e *Editor) RenameVersion(id, name string) error {
if err != nil {
return 0, err
}
extension := path.Ext(version.Location)
location := packageAvailableName(reader, nil, strings.TrimSuffix(version.Location, extension)+".edit"+extension)
location := packageAvailableName(reader, nil, version.Location)
body := root.childAt("DocBody", reader.documentIndex)
for _, node := range body.child("Versions").children {
if node.matchesOFD("Version") && node.attr("ID") == id {