summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2017-03-01 17:17:57 +0800
committerruki <[email protected]>2017-03-01 17:17:57 +0800
commit1ab4daf4fbdd148dc5b3ee879d36e9829e4753d7 (patch)
treecd0dcbc257d2fbc342dbf0dc0d3f468ab76f2d50
parent020da826110c507d6547c935b84858422635122f (diff)
add scriptdir vars
-rwxr-xr-xtests/console_c/xmake.lua9
-rw-r--r--xmake/core/project/project.lua2
2 files changed, 11 insertions, 0 deletions
diff --git a/tests/console_c/xmake.lua b/tests/console_c/xmake.lua
index 5bb1a2510..4156f32fc 100755
--- a/tests/console_c/xmake.lua
+++ b/tests/console_c/xmake.lua
@@ -30,3 +30,12 @@ target("console_c")
-- add files
add_files("src/*.c")
+ after_build(function(target)
+ import("core.project.config")
+ os.cd("src")
+ print(config.buildir())
+ print(vformat("$(scriptdir)"))
+ print(path.absolute(vformat("$(buildir)")))
+ os.cp("main.c", "$(buildir)/aaa")
+ end)
+
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua
index 6157ce951..40bee0a5e 100644
--- a/xmake/core/project/project.lua
+++ b/xmake/core/project/project.lua
@@ -43,6 +43,7 @@ local deprecated_project = require("project/deprecated/project")
local platform = require("platform/platform")
local environment = require("platform/environment")
local language = require("language/language")
+local sandbox_os = require("sandbox/modules/os")
-- the current os is belong to the given os?
function project._api_is_os(interp, ...)
@@ -288,6 +289,7 @@ function project._interpreter()
, prefix = "$(prefix)"
, tmpdir = os.tmpdir()
, curdir = os.curdir()
+ , scriptdir = sandbox_os.scriptdir()
, globaldir = global.directory()
, configdir = config.directory()
, projectdir = project.directory()