summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-10-23 00:29:36 +0800
committerruki <[email protected]>2021-10-23 00:29:36 +0800
commit6bac1ec396557471cf0651a3d8dadbb76234299c (patch)
tree8ad9646107eb045005a392af7c5a0af795303a9d
parent63301ceb02b675594799d2c36cd71d7bb3cc110b (diff)
improve project.chdir
-rw-r--r--xmake/core/sandbox/modules/import/core/project/project.lua5
-rw-r--r--xmake/modules/private/xrepo/action/env.lua2
2 files changed, 5 insertions, 2 deletions
diff --git a/xmake/core/sandbox/modules/import/core/project/project.lua b/xmake/core/sandbox/modules/import/core/project/project.lua
index 12b133b37..f515b3e74 100644
--- a/xmake/core/sandbox/modules/import/core/project/project.lua
+++ b/xmake/core/sandbox/modules/import/core/project/project.lua
@@ -160,7 +160,10 @@ function sandbox_core_project.unlock()
end
-- change project file and directory (xmake.lua)
-function sandbox_core_project.changefile(projectfile)
+function sandbox_core_project.chdir(projectdir, projectfile)
+ if not projectfile then
+ projectfile = path.join(projectdir, "xmake.lua")
+ end
xmake._PROJECT_FILE = projectfile
xmake._PROJECT_DIR = path.directory(projectfile)
xmake._WORKING_DIR = xmake._PROJECT_DIR
diff --git a/xmake/modules/private/xrepo/action/env.lua b/xmake/modules/private/xrepo/action/env.lua
index 7db7e7459..8590fcab9 100644
--- a/xmake/modules/private/xrepo/action/env.lua
+++ b/xmake/modules/private/xrepo/action/env.lua
@@ -139,7 +139,7 @@ function _enter_project(opt)
os.cd(workdir)
end
if opt.enteronly then
- project.changefile(path.join(workdir, "xmake.lua"))
+ project.chdir(workdir)
return
end