pw_env_setup: Move env dir to project root

Change-Id: I9739ac75e0782c7d95c1d74a762026a9a71b25ae
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/24660
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Reviewed-by: David Rogers <davidrogers@google.com>
diff --git a/pw_env_setup/util.sh b/pw_env_setup/util.sh
index 2a1168f..0c9f2e4 100644
--- a/pw_env_setup/util.sh
+++ b/pw_env_setup/util.sh
@@ -105,7 +105,11 @@
   # PW_ENVIRONMENT_ROOT came from the developer and not from a previous
   # bootstrap possibly from another workspace.
   if [ -z "$PW_ENVIRONMENT_ROOT" ]; then
-    echo "$PW_ROOT/.environment"
+    if [ -n "$PW_PROJECT_ROOT" ]; then
+      echo "$PW_PROJECT_ROOT/.environment"
+    else
+      echo "$PW_ROOT/.environment"
+    fi
   else
     echo "$PW_ENVIRONMENT_ROOT"
   fi