summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2017-12-17 14:11:44 +0800
committerruki <[email protected]>2017-12-17 14:11:44 +0800
commitb061bd17789d582771c77778e17a4f5576e1a01f (patch)
treed49269469a405f40a5b09cb1052a0a98382a2ad1
parent43ac21b112f81bbf2414a4295afd68123cccf468 (diff)
add seek to file
-rw-r--r--xmake/core/base/io.lua37
1 files changed, 5 insertions, 32 deletions
diff --git a/xmake/core/base/io.lua b/xmake/core/base/io.lua
index 8da88b10e..f91e1bead 100644
--- a/xmake/core/base/io.lua
+++ b/xmake/core/base/io.lua
@@ -35,63 +35,38 @@ local utils = require("base/utils")
io._open = io._open or io.open
io._isatty = io._isatty or io.isatty
+-- seek file
+function _file:seek(...)
+ return self._FILE:seek(...)
+end
+
-- read file
function _file:read(...)
-
- -- check
- assert(self._FILE)
-
- -- read it
return self._FILE:read(...)
end
-- write file
function _file:write(...)
-
- -- check
- assert(self._FILE)
-
- -- write it
return self._FILE:write(...)
end
-- print file
function _file:print(...)
-
- -- check
- assert(self._FILE)
-
- -- print it
return self._FILE:write(string.format(...) .. "\n")
end
-- printf file
function _file:printf(...)
-
- -- check
- assert(self._FILE)
-
- -- printf it
return self._FILE:write(string.format(...))
end
-- get lines
function _file:lines()
-
- -- check
- assert(self._FILE)
-
- -- get it
return self._FILE:lines()
end
-- close file
function _file:close()
-
- -- check
- assert(self._FILE)
-
- -- close it
return self._FILE:close()
end
@@ -160,8 +135,6 @@ end
-- save object
function _file:save(object)
-
- -- save it
return self:_save(object, 0)
end