From 33f11dae091a2dcb0f5dae61ed74a3a9853237de Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 6 Nov 2025 22:45:59 +0800 Subject: fix rootdir #6995 --- xmake/core/base/interpreter.lua | 8 +++----- 1 file 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) -- cgit v1.3.1