Skip to content

Commit 5921454

Browse files
committed
Fixed bug where dosfren.lua would append an extra newline under the shebang every subsequent run.
1 parent 7e181cc commit 5921454

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

demo/extra/dosfren.lua

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,14 @@ end
3131

3232
local function Shebang(inFile)
3333
inFile:seek("set", 0)
34-
local line1 = inFile:read("*l")
35-
if line1:match("^#!") then
36-
return StripCarriage(line1) .. LF .. CRLF
34+
local l = inFile:read("*l")
35+
if l:match("^#!") then
36+
local o = StripCarriage(l) .. LF .. CRLF
37+
l = inFile:read("*l")
38+
if l ~= "" and l ~= CR then -- Only write 2nd line if it's not blank
39+
o = o .. StripCarriage(l) .. CRLF
40+
end
41+
return o
3742
end
3843
return nil
3944
end

0 commit comments

Comments
 (0)