diff options
| author | Saikari <[email protected]> | 2026-02-02 09:19:59 +0300 |
|---|---|---|
| committer | Saikari <[email protected]> | 2026-02-02 09:19:59 +0300 |
| commit | 84dcbd0fa5ebaa612c851fb1694993a9aa3f3968 (patch) | |
| tree | 564ce612700e8871bff8a67a7d515b2b4d19f9d7 /xmake/plugins/lua | |
| parent | 077e2daa5a10dbd9e20a9f25bad74bb303678c66 (diff) | |
refactor: streamline utf8 BOM removal process in script content handling
Diffstat (limited to 'xmake/plugins/lua')
| -rw-r--r-- | xmake/plugins/lua/main.lua | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/xmake/plugins/lua/main.lua b/xmake/plugins/lua/main.lua index f5f7a6867..96ff6e40d 100644 --- a/xmake/plugins/lua/main.lua +++ b/xmake/plugins/lua/main.lua @@ -64,15 +64,11 @@ function main() local script_content = io.read("*a") if script_content then -- remove utf8 bom - if script_content:startswith(utf8.bom) then - script_content = script_content:ltrim(utf8.bom) - end + script_content = script_content:ltrim(utf8.bom) local shell = os.shell() if shell == "cmd" or shell == "powershell" or shell == "pwsh" or is_host("windows") then script_content = script_content:trim() - if script_content:startswith('"') and script_content:endswith('"') then - script_content = script_content:trim('\"') - end + script_content = script_content:trim('\"') script_content = script_content:replace("\\n", "\n", {plain = true}):replace("\\r", "\r", {plain = true}) end |
