summaryrefslogtreecommitdiff
path: root/xmake/core/sandbox/modules/os.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-07-31 23:32:36 +0800
committerruki <[email protected]>2022-07-31 23:32:36 +0800
commitbb28bbb01c73ab1d7e455479f3338466a983d7d4 (patch)
treec77b6942e68f972e01ef835ab794c42f4962c27e /xmake/core/sandbox/modules/os.lua
parent1f27cde3a9c4b7e6866d677a2dd4e8a9cd6027e6 (diff)
add os.touch
Diffstat (limited to 'xmake/core/sandbox/modules/os.lua')
-rw-r--r--xmake/core/sandbox/modules/os.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/xmake/core/sandbox/modules/os.lua b/xmake/core/sandbox/modules/os.lua
index 4c2509cc9..a5744c3b5 100644
--- a/xmake/core/sandbox/modules/os.lua
+++ b/xmake/core/sandbox/modules/os.lua
@@ -200,6 +200,15 @@ function sandbox_os.cd(dir)
return oldir
end
+-- touch file or directory
+function sandbox_os.touch(filepath, opt)
+ assert(filepath)
+ local ok, errors = os.touch(vformat(filepath), opt)
+ if not ok then
+ os.raise(errors)
+ end
+end
+
-- create directories
function sandbox_os.mkdir(dir)
assert(dir)