summaryrefslogtreecommitdiff
path: root/xmake/core/sandbox/modules/io.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-03-27 17:57:41 +0800
committerruki <[email protected]>2017-03-27 17:58:56 +0800
commit71d627e4aa9b5780e63fc6b679c74548844c5feb (patch)
tree46d8e8c874d045ca1f4d492b6edf82f5d716ae54 /xmake/core/sandbox/modules/io.lua
parent235bb967883ab0686bab731c8e94a4a0bb7677ab (diff)
fix io.read and io.write raw lua api
Diffstat (limited to 'xmake/core/sandbox/modules/io.lua')
-rw-r--r--xmake/core/sandbox/modules/io.lua11
1 files changed, 6 insertions, 5 deletions
diff --git a/xmake/core/sandbox/modules/io.lua b/xmake/core/sandbox/modules/io.lua
index d8b110c6e..bc01f696c 100644
--- a/xmake/core/sandbox/modules/io.lua
+++ b/xmake/core/sandbox/modules/io.lua
@@ -34,7 +34,8 @@ local sandbox_io = sandbox_io or {}
-- inherit some builtin interfaces
sandbox_io.flush = io.flush
-sandbox_io._read = io.read
+sandbox_io.read = io.read
+sandbox_io.write = io.write
-- print file
function sandbox_io._print(self, ...)
@@ -137,7 +138,7 @@ function sandbox_io.save(filepath, object)
end
-- read all data from file
-function sandbox_io.read(filepath)
+function sandbox_io.readfile(filepath)
-- check
assert(filepath)
@@ -146,7 +147,7 @@ function sandbox_io.read(filepath)
filepath = vformat(filepath)
-- done
- local result, errors = io.readall(filepath)
+ local result, errors = io.readfile(filepath)
if not result then
raise(errors)
end
@@ -156,7 +157,7 @@ function sandbox_io.read(filepath)
end
-- write all data to file
-function sandbox_io.write(filepath, data)
+function sandbox_io.writefile(filepath, data)
-- check
assert(filepath)
@@ -165,7 +166,7 @@ function sandbox_io.write(filepath, data)
filepath = vformat(filepath)
-- done
- local ok, errors = io.writall(filepath, data)
+ local ok, errors = io.writefile(filepath, data)
if not ok then
raise(errors)
end