summaryrefslogtreecommitdiff
path: root/xmake/core/sandbox/modules/io.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2026-01-15 00:57:06 +0800
committerruki <[email protected]>2026-01-15 00:57:06 +0800
commitdd18f22140b3d8a0a8491105f052df99273dab99 (patch)
treef296f2d23ca08531267eaf041b12a23522dff78d /xmake/core/sandbox/modules/io.lua
parent4ecd3eff0b966f7d16cf5d3dc413add12bb19486 (diff)
add io.convert
Diffstat (limited to 'xmake/core/sandbox/modules/io.lua')
-rw-r--r--xmake/core/sandbox/modules/io.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/xmake/core/sandbox/modules/io.lua b/xmake/core/sandbox/modules/io.lua
index 1b15d4495..0cafaa5f2 100644
--- a/xmake/core/sandbox/modules/io.lua
+++ b/xmake/core/sandbox/modules/io.lua
@@ -201,6 +201,17 @@ function sandbox_io.insert(filepath, lineidx, text, opt)
return data
end
+-- convert file encoding
+function sandbox_io.convert(inputfile, outputfile, opt)
+ assert(inputfile and outputfile)
+ inputfile = vformat(inputfile)
+ outputfile = vformat(outputfile)
+ local ok, errors = io.convert(inputfile, outputfile, opt)
+ if not ok then
+ raise(errors)
+ end
+end
+
-- get std file
function sandbox_io.stdfile(filepath)
assert(filepath)