diff options
| author | ruki <[email protected]> | 2015-06-03 17:32:55 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-06-03 17:32:55 +0800 |
| commit | 81970742272dc8b6f406f91f216374777786d256 (patch) | |
| tree | 86a3983dc24558015b7d7356ecd1ddb905355078 /xmake/scripts/base/io.lua | |
| parent | fc3638d5128d6f652d79df8985ca5efcb104d22f (diff) | |
redirect building output
Diffstat (limited to 'xmake/scripts/base/io.lua')
| -rw-r--r-- | xmake/scripts/base/io.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/xmake/scripts/base/io.lua b/xmake/scripts/base/io.lua index 28bc5f24d..a1ac152ce 100644 --- a/xmake/scripts/base/io.lua +++ b/xmake/scripts/base/io.lua @@ -100,5 +100,22 @@ function io.save(file, object, prefix) return io._save_with_level(file, object, 0) end +-- cat the given file +function io.cat(filepath) + + -- open file + local file = io.open(filepath, "r") + if file then + + -- show file + for line in file:lines() do + print(line) + end + + -- exit file + file:close() + end +end + -- return module: io return io |
