mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-10-26 21:16:56 +00:00
Fix version quoting in Apple project update script
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/cmd/internal/build_shared"
|
"github.com/sagernet/sing-box/cmd/internal/build_shared"
|
||||||
|
"github.com/sagernet/sing-box/common/badversion"
|
||||||
"github.com/sagernet/sing-box/log"
|
"github.com/sagernet/sing-box/log"
|
||||||
"github.com/sagernet/sing/common"
|
"github.com/sagernet/sing/common"
|
||||||
|
|
||||||
@@ -76,11 +77,20 @@ func findAndReplace(objectsMap map[string]any, projectContent string, bundleIDLi
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
updated = true
|
updated = true
|
||||||
projectContent = projectContent[:versionStart] + "\"" + newVersion + "\"" + projectContent[versionEnd:]
|
projectContent = projectContent[:versionStart] + formatProjectVersion(newVersion) + projectContent[versionEnd:]
|
||||||
}
|
}
|
||||||
return projectContent, updated
|
return projectContent, updated
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Xcode serializes a version without quotes unless it contains a pre-release
|
||||||
|
// part; always quoting makes Xcode rewrite the value on the next save.
|
||||||
|
func formatProjectVersion(version string) string {
|
||||||
|
if badversion.Parse(version).PreReleaseIdentifier == "" {
|
||||||
|
return version
|
||||||
|
}
|
||||||
|
return "\"" + version + "\""
|
||||||
|
}
|
||||||
|
|
||||||
func findAndReplaceProjectVersion(objectsMap map[string]any, projectContent string, directoryList []string, newVersion string) (string, bool) {
|
func findAndReplaceProjectVersion(objectsMap map[string]any, projectContent string, directoryList []string, newVersion string) (string, bool) {
|
||||||
objectKeyList := findObjectKeyByDirectory(objectsMap, directoryList)
|
objectKeyList := findObjectKeyByDirectory(objectsMap, directoryList)
|
||||||
var updated bool
|
var updated bool
|
||||||
|
|||||||
Reference in New Issue
Block a user