diff options
| author | ruki <[email protected]> | 2025-09-20 17:14:49 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-09-20 17:14:49 +0800 |
| commit | 4c80a8b424b5433a375653e31a5f98f8863fdfb3 (patch) | |
| tree | 9c1b9d9f72885ae2166624443781a9b9f17b4e2d | |
| parent | 39308203867432767ba3cffd63201726f10024ab (diff) | |
fix enter project
| -rw-r--r-- | xmake/modules/private/xrepo/action/env.lua | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/xmake/modules/private/xrepo/action/env.lua b/xmake/modules/private/xrepo/action/env.lua index c4179b951..ddc7d5f96 100644 --- a/xmake/modules/private/xrepo/action/env.lua +++ b/xmake/modules/private/xrepo/action/env.lua @@ -270,19 +270,20 @@ function _package_getenvs(opt) local has_packages = #packages > 0 local in_project = os.isfile(os.projectfile()) and not option.get("bind") local oldir = os.curdir() - if has_envfiles or has_packages then + if not in_project then _enter_project() - if has_envfiles then - table.join2(project.rcfiles(), envfiles) - else - local envfile = os.tmpfile() .. ".lua" - local file = io.open(envfile, "w") - for _, requirename in ipairs(packages) do - file:print("add_requires(\"%s\")", requirename) - end - file:close() - table.insert(project.rcfiles(), envfile) + end + if has_envfiles then + table.join2(project.rcfiles(), envfiles) + end + if has_packages then + local envfile = os.tmpfile() .. ".lua" + local file = io.open(envfile, "w") + for _, requirename in ipairs(packages) do + file:print("add_requires(\"%s\")", requirename) end + file:close() + table.insert(project.rcfiles(), envfile) end if in_project or has_envfiles or has_packages then task.run("config", {}, {disable_dump = true}) |
