fix(windows): use HOMEPATH in place of HOME

This commit is contained in:
Alex Eagle 2023-07-21 10:35:22 -07:00
parent 5ecaeb5c53
commit 383bbd589b
1 changed files with 5 additions and 0 deletions

View File

@ -40,6 +40,11 @@ def _get_env_var(rctx, name, default):
Returns:
The environment variable value or the default if it is not set
"""
# On Windows, the HOME environment variable is named differently.
# See https://pureinfotech.com/list-environment-variables-windows-10/
if name == "HOME" and _is_windows(rctx):
name = "HOMEPATH"
if name in rctx.os.environ:
return rctx.os.environ[name]
return default