Add capture support to UTF8 BOM output
If `io.utf8()` is called while running unit tests, it would be output directly to the console since there is no active file output while testing. Replace call with premake.utf8() as a companion to premake.w() and ignore while capturing to prevent this spurious output.
This commit is contained in:
parent
d25e1061d0
commit
bfc67b5c51
@ -1 +1 @@
|
||||
Subproject commit a72d326601add809cd5c5c2af7851cdc311767cc
|
||||
Subproject commit 287ffc60d66ec36f9120061ddcc9ff44a6950c6f
|
@ -33,7 +33,7 @@
|
||||
}
|
||||
|
||||
function cs2005.generate(prj)
|
||||
io.utf8()
|
||||
p.utf8()
|
||||
|
||||
premake.callarray(cs2005, cs2005.elements.project, prj)
|
||||
|
||||
|
@ -48,7 +48,7 @@
|
||||
end
|
||||
|
||||
function m.generate(prj)
|
||||
io.utf8()
|
||||
p.utf8()
|
||||
p.callArray(m.elements.project, prj)
|
||||
p.out('</Project>')
|
||||
end
|
||||
|
@ -20,12 +20,3 @@
|
||||
end
|
||||
return base(fname, mode)
|
||||
end)
|
||||
|
||||
|
||||
--
|
||||
-- Output a UTF-8 signature.
|
||||
--
|
||||
|
||||
function io.utf8()
|
||||
io.write('\239\187\191')
|
||||
end
|
||||
|
@ -304,6 +304,18 @@ end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Output a UTF-8 BOM to the exported file.
|
||||
--
|
||||
|
||||
function premake.utf8()
|
||||
if not _captured then
|
||||
premake.out('\239\187\191')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
---
|
||||
-- Write a formatted string to the exported file, at the current
|
||||
-- level of indentation, and appends an end of line sequence.
|
||||
|
Reference in New Issue
Block a user