summaryrefslogtreecommitdiff
path: root/xmake/core/base/os.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2025-09-28 09:35:48 +0800
committerruki <[email protected]>2025-09-28 09:45:11 +0800
commit0e4844720e073b6d7fc3e8cad093a040155173ce (patch)
tree0361e1f2b17cb9fc19d978385a882e05630fc738 /xmake/core/base/os.lua
parentdd07af97f1b28ed18a9cd4a66dfd574f8fc795fb (diff)
improve os.getenvs
Diffstat (limited to 'xmake/core/base/os.lua')
-rw-r--r--xmake/core/base/os.lua23
1 files changed, 0 insertions, 23 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index 57046813e..41fe07d22 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -42,7 +42,6 @@ os._tmpdir = os._tmpdir or os.tmpdir
os._curdir = os._curdir or os.curdir
os._fscase = os._fscase or os.fscase
os._setenv = os._setenv or os.setenv
-os._getenvs = os._getenvs or os.getenvs
os._cpuinfo = os._cpuinfo or os.cpuinfo
os._meminfo = os._meminfo or os.meminfo
os._readlink = os._readlink or os.readlink
@@ -1300,28 +1299,6 @@ function os.term()
return require("base/tty").term()
end
--- get all current environment variables
--- e.g. envs["PATH"] = "/xxx:/yyy/foo"
-function os.getenvs()
- local envs = {}
- for _, line in ipairs(os._getenvs()) do
- local p = line:find('=', 1, true)
- if p then
- local key = line:sub(1, p - 1):trim()
- -- only translate Path to PATH on windows
- -- @see https://github.com/xmake-io/xmake/issues/3752
- if os.host() == "windows" and key:lower() == "path" then
- key = key:upper()
- end
- local values = line:sub(p + 1):trim()
- if #key > 0 then
- envs[key] = values
- end
- end
- end
- return envs
-end
-
-- set all current environment variables
-- e.g. envs["PATH"] = "/xxx:/yyy/foo"
function os.setenvs(envs)