summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-11-17 00:00:08 +0800
committerruki <[email protected]>2020-11-17 00:00:08 +0800
commit6bf2b94cd10acdf490bcef6d69add2615336ffa7 (patch)
treede662e435d9a41c7cdc7f76535a1f41201394921
parent65c33b62b77dd00cde68792c975b4b7c1394563e (diff)
improve scriptdir
-rw-r--r--xmake/core/base/interpreter.lua7
-rw-r--r--xmake/core/project/project.lua3
2 files changed, 8 insertions, 2 deletions
diff --git a/xmake/core/base/interpreter.lua b/xmake/core/base/interpreter.lua
index 818ff9576..a92225711 100644
--- a/xmake/core/base/interpreter.lua
+++ b/xmake/core/base/interpreter.lua
@@ -748,13 +748,20 @@ end
function interpreter:make(scope_kind, remove_repeat, enable_filter)
-- get the results with the given scope
+ self._PENDING = true
local ok, results = xpcall(interpreter._make, interpreter._traceback, self, scope_kind, remove_repeat, enable_filter)
+ self._PENDING = false
if not ok then
return nil, results
end
return results
end
+-- is pending?
+function interpreter:pending()
+ return self._PENDING
+end
+
-- get all loaded script files (xmake.lua)
function interpreter:scriptfiles()
assert(self and self._PRIVATE)
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua
index d6b6cb200..1a684d8bb 100644
--- a/xmake/core/project/project.lua
+++ b/xmake/core/project/project.lua
@@ -757,10 +757,9 @@ function project.interpreter()
os = platform.os()
, host = os.host()
, subhost = os.subhost()
- , prefix = "$(prefix)"
, tmpdir = function () return os.tmpdir() end
, curdir = function () return os.curdir() end
- , scriptdir = function () return interp:scriptdir() end
+ , scriptdir = function () return interp:pending() and interp:scriptdir() or sandbox_os.scriptdir() end
, globaldir = global.directory()
, configdir = config.directory()
, projectdir = project.directory()