From 433ac3c54d5cad4409ef24fe44f32ccef1da2c13 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 2 Jun 2020 23:06:00 +0800 Subject: add comments --- xmake/core/project/config.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/xmake/core/project/config.lua b/xmake/core/project/config.lua index 382ab03e0..837e45faf 100644 --- a/xmake/core/project/config.lua +++ b/xmake/core/project/config.lua @@ -131,7 +131,14 @@ function config.buildir() -- get the absolute path first if not path.is_absolute(buildir) then - buildir = path.absolute(buildir, os.projectdir()) + local rootdir + if os.isdir(path.join(os.workingdir(), ".xmake")) then + -- we switch to independent working directory @see https://github.com/xmake-io/xmake/issues/820 + rootdir = os.workingdir() + else + rootdir = os.projectdir() + end + buildir = path.absolute(buildir, rootdir) end -- adjust path for the current directory @@ -150,6 +157,7 @@ function config.directory() if config._DIRECTORY == nil then local rootdir = os.getenv("XMAKE_CONFIGDIR") if not rootdir and os.isdir(path.join(os.workingdir(), ".xmake")) then + -- we switch to independent working directory @see https://github.com/xmake-io/xmake/issues/820 rootdir = os.workingdir() end if not rootdir then -- cgit v1.3.1