summaryrefslogtreecommitdiff
path: root/xmake/core/base/io.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-04-16 16:35:21 +0800
committerruki <[email protected]>2022-04-16 16:35:21 +0800
commit983e8ed319b4e0d84a47d43bcaa3a154e7c74175 (patch)
tree0d97437585a0c70eaddacee3bf8ec230d8f565a0 /xmake/core/base/io.lua
parentc72bd4e4c7727efb224085183fd15b965c023cbd (diff)
improve write file
Diffstat (limited to 'xmake/core/base/io.lua')
-rw-r--r--xmake/core/base/io.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/xmake/core/base/io.lua b/xmake/core/base/io.lua
index 54d84522d..16b0efc46 100644
--- a/xmake/core/base/io.lua
+++ b/xmake/core/base/io.lua
@@ -201,8 +201,17 @@ function _file:write(...)
return false, errors
end
+ -- data items
+ local items = table.pack(...)
+ for idx, item in ipairs(items) do
+ if type(item) == "table" and item.caddr and item.size then
+ -- write bytes
+ items[idx] = {data = item:caddr(), size = item:size()}
+ end
+ end
+
-- write file
- ok, errors = io.file_write(self:cdata(), ...)
+ ok, errors = io.file_write(self:cdata(), table.unpack(items))
if not ok and errors then
errors = string.format("%s: %s", self, errors)
end