From a77d952750ca1a95d972058ac0ca309305047087 Mon Sep 17 00:00:00 2001
From: Goran Lazarevski <goranmrd@gmail.com>
Date: Wed, 19 Mar 2025 21:56:14 +0100
Subject: [PATCH] Use absolute path for LR

---
 .gitea/workflows/unreal-build.yml | 31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/.gitea/workflows/unreal-build.yml b/.gitea/workflows/unreal-build.yml
index 10aa9258..6da324d6 100644
--- a/.gitea/workflows/unreal-build.yml
+++ b/.gitea/workflows/unreal-build.yml
@@ -78,34 +78,47 @@ jobs:
           echo "=== Environment Information ==="
           echo "macOS Version:"
           sw_vers
+          echo "Current working directory: $(pwd)"
+          ls -la  # List all files in current directory
+          
           echo "=== Unreal Engine Information ==="
           ls -la "$UE_ROOT/Build/BatchFiles"
+          
           echo "=== Project Information ==="
+          # Detailed search for the project file
+          echo "Searching for .uproject files:"
+          find . -name "*.uproject" -type f
           
-          source "$GITHUB_ENV"
-          
+          # Get the absolute path of the project file
           UPROJECT_PATH=$(find . -name "*.uproject" -type f | head -1)
           if [ -z "$UPROJECT_PATH" ]; then
             echo "Error: Could not find .uproject file"
             exit 1
           fi
-          echo "Building project: $UPROJECT_PATH"
           
-          echo "Using Unreal Engine at: $UE_ROOT"
-          if [ ! -f "$UE_ROOT/Build/BatchFiles/RunUAT.sh" ]; then
-            echo "Error: RunUAT.sh not found at $UE_ROOT/Build/BatchFiles/RunUAT.sh"
-            echo "Please check UE_ROOT path"
+          # Convert to absolute path and verify file exists
+          UPROJECT_ABSOLUTE_PATH=$(realpath "$UPROJECT_PATH")
+          echo "Project absolute path: $UPROJECT_ABSOLUTE_PATH"
+          
+          if [ ! -f "$UPROJECT_ABSOLUTE_PATH" ]; then
+            echo "Error: Project file does not exist at: $UPROJECT_ABSOLUTE_PATH"
             exit 1
           fi
           
+          echo "Using Unreal Engine at: $UE_ROOT"
+          
+          # Make the project file readable and executable
+          chmod 755 "$UPROJECT_ABSOLUTE_PATH"
+          
+          # Run the build using absolute paths
           chmod +x "$UE_ROOT/Build/BatchFiles/RunUAT.sh"
           "$UE_ROOT/Build/BatchFiles/RunUAT.sh" BuildCookRun \
-            -project="$UPROJECT_PATH" \
+            -project="$UPROJECT_ABSOLUTE_PATH" \
             -noP4 \
             -platform=Mac \
             -clientconfig=Development \
             -cook -build -stage -pak -archive \
-            -archivedirectory="$PWD/Build"
+            -archivedirectory="$(pwd)/Build"
       
       - name: Upload build artifacts
         uses: actions/upload-artifact@v3