Skip to content

Commit 378b288

Browse files
committed
Refactor RMLevelLoaderGen execution to bypass batch file and improve error handling for output generation
1 parent f2ca6b8 commit 378b288

File tree

1 file changed

+23
-24
lines changed

1 file changed

+23
-24
lines changed

.github/workflows/deploy.yml

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -56,49 +56,48 @@ jobs:
5656
5757
pnpm build
5858
59-
# Check for ui.vuic in parent folder (RealityMod root)
6059
if (-not (Test-Path "..\ui.vuic")) {
6160
Write-Error "FAILURE: ui.vuic was not found in RealityMod root!"
6261
exit 1
6362
}
6463
65-
# --- 5. RM LEVEL LOADER GEN (Fixed & Patched) ---
64+
# --- 5. RM LEVEL LOADER GEN (Direct Execution) ---
6665
- name: Run RMLevelLoaderGen
6766
working-directory: ${{ github.workspace }}
6867
env:
6968
GH_TOKEN: ${{ secrets.GH_PAT }}
7069
run: |
70+
# 1. Clone
7171
git clone https://oauth2:$env:GH_TOKEN@github.com/BF3RM/RMLevelLoaderGen.git temp_loader
7272
cd temp_loader
7373
74-
Write-Host "--- Patching generate.bat ---"
75-
# 1. Read Content
76-
$content = Get-Content generate.bat -Raw
74+
# 2. Execute the Generator Directly (Bypassing generate.bat)
75+
# Based on the bat file content you shared:
76+
# call .\LevelLoaderGen/bin/levelloader-gen -i .\in rm-levelloader 0.3.9
7777
78-
# 2. Fix: Remove 'pause'
79-
$content = $content -replace 'pause', 'REM pause'
78+
$ExePath = ".\LevelLoaderGen\bin\levelloader-gen.exe"
8079
81-
# 3. Fix: Replace Linux style ./ with Windows .\ (Fixes '.' is not recognized)
82-
$content = $content -replace '\./', '.\'
83-
84-
# 4. Save and Print
85-
Set-Content -Path generate.bat -Value $content
86-
Write-Host $content
87-
88-
Write-Host "--- Running generate.bat ---"
89-
cmd /c generate.bat
80+
if (-not (Test-Path $ExePath)) {
81+
Write-Warning "Could not find .exe at $ExePath. Listing directory to debug..."
82+
Get-ChildItem -Recurse
83+
exit 1
84+
}
85+
86+
Write-Host "--- Executing Generator ---"
87+
& $ExePath -i ".\in" "rm-levelloader" "0.3.9"
9088
91-
Write-Host "--- Searching for output ---"
89+
# 3. Locate and Move Output
90+
# You mentioned it is created in RMLevelLoaderGen\mods
91+
$GeneratedPath = "mods\rm-levelloader"
9292
$Dest = "..\Build\Admin\Mods\rm-levelloader"
9393
94-
# Search recursively in the User Profile (Documents, etc) and current dir for the folder
95-
$Found = Get-ChildItem -Path "$env:USERPROFILE" -Filter "rm-levelloader" -Recurse -Directory -ErrorAction SilentlyContinue | Select-Object -First 1
96-
97-
if ($Found) {
98-
Write-Host "Found generated folder at: $($Found.FullName)"
99-
Move-Item -Path $Found.FullName -Destination $Dest -Force
94+
if (Test-Path $GeneratedPath) {
95+
Write-Host "Found output at $GeneratedPath"
96+
Move-Item -Path $GeneratedPath -Destination $Dest -Force
10097
} else {
101-
Write-Error "FATAL: Could not find 'rm-levelloader' folder anywhere in $env:USERPROFILE"
98+
Write-Error "FATAL: Could not find generated 'mods\rm-levelloader' folder."
99+
Write-Host "--- Listing Directory Content ---"
100+
Get-ChildItem -Recurse
102101
exit 1
103102
}
104103

0 commit comments

Comments
 (0)