Update gn_silabs_example to use PW_ENVIRONMENT_ROOT's gn install if… (#35755)

* Update gn_silabs_example to use PW_ENVIRONMENT_ROOT's gn install if declared else default to the expected matter bootstrapped environment location

* Fix so bootstrap is run when PW_ENVIRONMENT_ROOT is set
diff --git a/scripts/examples/gn_silabs_example.sh b/scripts/examples/gn_silabs_example.sh
index 4577926..a72e4e1 100755
--- a/scripts/examples/gn_silabs_example.sh
+++ b/scripts/examples/gn_silabs_example.sh
@@ -28,14 +28,21 @@
     CHIP_ROOT="$MATTER_ROOT"
 fi
 
+if [[ -z "${PW_ENVIRONMENT_ROOT}" ]]; then
+    echo "Using the bootstrapped pigweed ENV in Matter root"
+    PW_PATH="$CHIP_ROOT/.environment/cipd/packages/pigweed"
+else
+    echo "Using provided $PW_ENVIRONMENT_ROOT as Pigweed ENV root"
+    PW_PATH="$PW_ENVIRONMENT_ROOT/cipd/packages/pigweed"
+fi
+
 set -x
 env
 USE_WIFI=false
 USE_DOCKER=false
 USE_GIT_SHA_FOR_VERSION=true
 USE_SLC=false
-GN_PATH=gn
-GN_PATH_PROVIDED=false
+GN_PATH="$PW_PATH/gn"
 USE_BOOTLOADER=false
 DOTFILE=".gn"
 
@@ -260,7 +267,6 @@
                 ;;
             --slc_reuse_files)
                 optArgs+="slc_reuse_files=true "
-                USE_SLC=true
                 shift
                 ;;
             --gn_path)
@@ -270,7 +276,6 @@
                 else
                     GN_PATH="$2"
                 fi
-                GN_PATH_PROVIDED=true
                 shift
                 shift
                 ;;
@@ -310,11 +315,7 @@
         } &>/dev/null
     fi
 
-    if [ "$USE_SLC" == true ]; then
-        if [ "$GN_PATH_PROVIDED" == false ]; then
-            GN_PATH=./.environment/cipd/packages/pigweed/gn
-        fi
-    elif [ "$USE_SLC" == false ]; then
+    if [ "$USE_SLC" == false ]; then
         # Activation needs to be after SLC generation which is done in gn gen.
         # Zap generation requires activation and is done in the build phase
         source "$CHIP_ROOT/scripts/activate.sh"