mirror of
https://github.com/pesde-pkg/tooling.git
synced 2025-01-08 07:29:10 +00:00
fix: substitute version on platforms with different line endings
This commit is contained in:
parent
52c8992fe3
commit
d219a8b668
1 changed files with 10 additions and 4 deletions
|
@ -138,12 +138,18 @@ for _, binSrc in pathfs.readDir(BINS_SRC_DIR) do
|
||||||
-- HACK: To prevent messing with our existing toml ordering and formatting
|
-- HACK: To prevent messing with our existing toml ordering and formatting
|
||||||
-- we just replace the old version field string with the new version field
|
-- we just replace the old version field string with the new version field
|
||||||
-- string
|
-- string
|
||||||
|
|
||||||
|
-- the string returned by serde.encode end with newlines, so remove them to maintain compatibility with different line endings
|
||||||
|
-- Old version field string:
|
||||||
|
local oldField = string.gsub(serde.encode("toml", { version = manifest.version }), "%s+$", "")
|
||||||
|
|
||||||
|
-- New version field string:
|
||||||
|
local newField = string.gsub(serde.encode("toml", { version = stripLeadingVersion(newVersion) }), "%s+$", "")
|
||||||
|
|
||||||
local updatedManifest = string.gsub(
|
local updatedManifest = string.gsub(
|
||||||
manifestContents,
|
manifestContents,
|
||||||
-- Old version field string:
|
oldField,
|
||||||
serde.encode("toml", { version = manifest.version }),
|
newField,
|
||||||
-- New version field string:
|
|
||||||
serde.encode("toml", { version = stripLeadingVersion(newVersion) }),
|
|
||||||
-- Only replace the first occurrence to be safe
|
-- Only replace the first occurrence to be safe
|
||||||
1
|
1
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue