pw_env_setup: allow setting environment directory

Allow setting of environment installation directory. Everything created
from environment setup gets installed into this directory.

The first time bootstrap is run after this commit is applied will take
longer, and eventually the old paths should be removed from .gitignore
(and deleted).

Bug: 216
Change-Id: I92ebe8a2414998cb5e4ae9ef3a92d6b50ffa8fab
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/13600
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Rob Mohr <mohrr@google.com>
diff --git a/bootstrap.bat b/bootstrap.bat
index 7abe3a4..ed38285 100644
--- a/bootstrap.bat
+++ b/bootstrap.bat
@@ -56,6 +56,12 @@
   )
 )
 
+:: Not prefixing environment with "." since that doesn't hide it anyway.
+if "%PW_ENVIRONMENT_ROOT%"=="" (
+   set "PW_ENVIRONMENT_ROOT=%PW_ROOT%\environment"
+)
+set "shell_file=%PW_ENVIRONMENT_ROOT%\activate.bat"
+
 set _PW_OLD_CIPD_PACKAGE_FILES=%PW_CIPD_PACKAGE_FILES%
 set _PW_OLD_VIRTUALENV_REQUIREMENTS=%PW_VIRTUALENV_REQUIREMENTS%
 set _PW_OLD_VIRTUALENV_SETUP_PY_ROOTS=%PW_VIRTUALENV_SETUP_PY_ROOTS%
@@ -67,7 +73,6 @@
 set PW_CARGO_PACKAGE_FILES=%PW_ROOT%\pw_env_setup\py\pw_env_setup\cargo_setup\packages.txt;%PW_CARGO_PACKAGE_FILES%
 
 set "_pw_start_script=%PW_ROOT%\pw_env_setup\py\pw_env_setup\windows_env_start.py"
-set "shell_file=%PW_ROOT%\pw_env_setup\.env_setup.bat"
 
 :: If PW_SKIP_BOOTSTRAP is set, only run the activation stage instead of the
 :: complete env_setup.
@@ -76,7 +81,8 @@
   :: the --shell-file argument.
   call "%python%" "%PW_ROOT%\pw_env_setup\py\pw_env_setup\env_setup.py" ^
       --pw-root "%PW_ROOT%/" ^
-      --shell-file "%shell_file%"
+      --shell-file "%shell_file%" ^
+      --install-dir "%PW_ENVIRONMENT_ROOT%"
 ) else (
   if exist "%shell_file%" (
     call "%python%" "%_pw_start_script%"