Avoid setting EM_CACHE unless we really need to (#797)

This avoid polluting the global environment which makes
side-by-side installational of different emscripten version
harder.

See https://github.com/emscripten-core/emscripten/pull/13954
This commit is contained in:
Sam Clegg
2021-04-26 06:29:01 -07:00
committed by GitHub
parent cee96f8054
commit 4282d5d44b
4 changed files with 28 additions and 20 deletions

View File

@@ -32,7 +32,6 @@ try {
$EMSDK_NODE = [System.Environment]::GetEnvironmentVariable("EMSDK_NODE", $env_type)
$EMSDK_PYTHON = [System.Environment]::GetEnvironmentVariable("EMSDK_PYTHON", $env_type)
$JAVA_HOME = [System.Environment]::GetEnvironmentVariable("JAVA_HOME", $env_type)
$EM_CACHE = [System.Environment]::GetEnvironmentVariable("EM_CACHE", $env_type)
$PATH = [System.Environment]::GetEnvironmentVariable("PATH", $env_type)
if (!$EMSDK) {
@@ -50,9 +49,6 @@ try {
if (!$EMSDK_PYTHON) {
throw "EMSDK_PYTHON is not set for the user"
}
if (!$EM_CACHE) {
throw "EM_CACHE is not set for the user"
}
$path_split = $PATH.Split(';')
@@ -91,7 +87,6 @@ finally {
[Environment]::SetEnvironmentVariable("EMSDK_NODE", $null, "User")
[Environment]::SetEnvironmentVariable("EMSDK_PYTHON", $null, "User")
[Environment]::SetEnvironmentVariable("JAVA_HOME", $null, "User")
[Environment]::SetEnvironmentVariable("EM_CACHE", $null, "User")
try {
[Environment]::SetEnvironmentVariable("EMSDK", $null, "Machine")
@@ -99,7 +94,6 @@ finally {
[Environment]::SetEnvironmentVariable("EMSDK_NODE", $null, "Machine")
[Environment]::SetEnvironmentVariable("EMSDK_PYTHON", $null, "Machine")
[Environment]::SetEnvironmentVariable("JAVA_HOME", $null, "Machine")
[Environment]::SetEnvironmentVariable("EM_CACHE", $null, "Machine")
} catch {}
@@ -108,7 +102,6 @@ finally {
[Environment]::SetEnvironmentVariable("EMSDK_NODE", $null, "Process")
[Environment]::SetEnvironmentVariable("EMSDK_PYTHON", $null, "Process")
[Environment]::SetEnvironmentVariable("JAVA_HOME", $null, "Process")
[Environment]::SetEnvironmentVariable("EM_CACHE", $null, "Process")
refreshenv
}