Move some proj detection code inside pre_check_environment

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh
index 5cf8e60..10dbe56 100755
--- a/tests/scripts/all.sh
+++ b/tests/scripts/all.sh
@@ -116,12 +116,6 @@
 shopt -s extglob
 
 # For project detection
-PROJECT_NAME_FILE='./scripts/project_name.txt'
-if read -r PROJECT_NAME < "$PROJECT_NAME_FILE"; then :; else
-    echo "$PROJECT_NAME_FILE does not exist... Exiting..." >&2
-    exit 1
-fi
-
 in_mbedtls_repo () {
     test "$PROJECT_NAME" = "Mbed TLS"
 }
@@ -131,6 +125,13 @@
 }
 
 pre_check_environment () {
+    # For project detection
+    PROJECT_NAME_FILE='./scripts/project_name.txt'
+    if read -r PROJECT_NAME < "$PROJECT_NAME_FILE"; then :; else
+        echo "$PROJECT_NAME_FILE does not exist... Exiting..." >&2
+        exit 1
+    fi
+
     if in_mbedtls_repo || in_tf_psa_crypto_repo; then :; else
         echo "Must be run from Mbed TLS / TF-PSA-Crypto root" >&2
         exit 1