summaryrefslogtreecommitdiff
path: root/xmake/core/sandbox/modules/os.lua
diff options
context:
space:
mode:
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, ...)