summaryrefslogtreecommitdiff
path: root/xmake/core/sandbox/modules/os.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2016-06-01 08:16:54 +0800
committerruki <[email protected]>2016-06-01 08:16:54 +0800
commite720bbe224eb7aec57ca488a67e840a685fe612f (patch)
tree2735ac6524ec7ca93f7508eadfdfc3241ee08f0c /xmake/core/sandbox/modules/os.lua
parent5b2e0333389158094a2a8bb796e13f99fac422e7 (diff)
list lua scripts and fix arguments
Diffstat (limited to 'xmake/core/sandbox/modules/os.lua')
-rw-r--r--xmake/core/sandbox/modules/os.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/xmake/core/sandbox/modules/os.lua b/xmake/core/sandbox/modules/os.lua
index 923cc5852..9babc4318 100644
--- a/xmake/core/sandbox/modules/os.lua
+++ b/xmake/core/sandbox/modules/os.lua
@@ -24,6 +24,7 @@
local io = require("base/io")
local os = require("base/os")
local utils = require("base/utils")
+local sandbox = require("sandbox/sandbox")
local vformat = require("sandbox/modules/vformat")
-- define module
@@ -174,6 +175,21 @@ function sandbox_os.programdir()
return xmake._PROGRAM_DIR
end
+-- get the script directory
+function sandbox_os.scriptdir()
+
+ -- get the current sandbox instance
+ local instance = sandbox.instance()
+ assert(instance)
+
+ -- the root directory for this sandbox script
+ local rootdir = instance:rootdir()
+ assert(rootdir)
+
+ -- ok
+ return rootdir
+end
+
-- run shell
function sandbox_os.run(cmd, ...)