summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-11-07 07:19:28 +0800
committerGitHub <[email protected]>2025-11-07 07:19:28 +0800
commit842f360a4b25591ac8780129aa740d5c4e0a63ed (patch)
treedc26f7917a1f645ac8d158add651cb7583cbd047
parent12f9fb3c6b097f51329e2dcce0b2136b5235d323 (diff)
parent33f11dae091a2dcb0f5dae61ed74a3a9853237de (diff)
Merge pull request #6999 from xmake-io/rootdir
fix rootdir #6995
-rw-r--r--xmake/core/base/interpreter.lua8
1 files changed, 3 insertions, 5 deletions
diff --git a/xmake/core/base/interpreter.lua b/xmake/core/base/interpreter.lua
index afb5e4412..f325ec3d2 100644
--- a/xmake/core/base/interpreter.lua
+++ b/xmake/core/base/interpreter.lua
@@ -770,7 +770,8 @@ function interpreter:load(file, opt)
self:_clear()
-- translate to absolute file path for scriptdir/rootdir
- file = path.absolute(file)
+ -- we need to normalize path for rootdir, @see https://github.com/xmake-io/xmake/issues/6995
+ file = path.normalize(path.absolute(file))
-- init the current file
self._PRIVATE._CURFILE = file
@@ -1865,11 +1866,8 @@ function interpreter:api_builtin_includes(...)
-- clear the current scope, force to enter root scope
scopes._CURRENT = nil
- -- save the current directory
- local oldir = os.curdir()
-
-- enter the script directory
- os.cd(path.directory(file))
+ local oldir = os.cd(path.directory(file))
-- done interpreter
local ok, errors = xpcall(script, interpreter._traceback)