diff options
Diffstat (limited to 'xmake/core/sandbox/modules/io.lua')
| -rw-r--r-- | xmake/core/sandbox/modules/io.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/xmake/core/sandbox/modules/io.lua b/xmake/core/sandbox/modules/io.lua index 53d8399f4..7f93f020d 100644 --- a/xmake/core/sandbox/modules/io.lua +++ b/xmake/core/sandbox/modules/io.lua @@ -77,6 +77,16 @@ function sandbox_io.gsub(filepath, pattern, replace) return data, count end +-- check if file exists +function sandbox_io.exists(filepath) + local file, _ = io.open(filepath, "r") + if file then + file:close() + return true + end + return false +end + -- open file function sandbox_io.open(filepath, mode) |
