From d219a8b668246765f1c1f62427cbbb413ff27a55 Mon Sep 17 00:00:00 2001 From: daimond113 <72147841+daimond113@users.noreply.github.com> Date: Sun, 15 Dec 2024 01:03:03 +0100 Subject: [PATCH] fix: substitute version on platforms with different line endings --- .lune/update_tools.luau | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.lune/update_tools.luau b/.lune/update_tools.luau index 7b404c0..ded1c84 100644 --- a/.lune/update_tools.luau +++ b/.lune/update_tools.luau @@ -138,12 +138,18 @@ for _, binSrc in pathfs.readDir(BINS_SRC_DIR) do -- HACK: To prevent messing with our existing toml ordering and formatting -- we just replace the old version field string with the new version field -- 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( manifestContents, - -- Old version field string: - serde.encode("toml", { version = manifest.version }), - -- New version field string: - serde.encode("toml", { version = stripLeadingVersion(newVersion) }), + oldField, + newField, -- Only replace the first occurrence to be safe 1 )