fix: Decouple auto-load from build settings

This commit is contained in:
VAC committed 2026-10-14 23:44:14 -03:00
1 parent f594a72950
commit 69b1f4895a
3 files changed
+11 -9

No files matched your search

+6 -6
View File
@@ -6,9 +6,9 @@ set "HOOK=%ROOT%bin\TerraSharp.tModLoader.dll"
set "TERRASHARP_AUTOLOAD_SCRIPT=%~f0"
if not "%~1"=="" goto launcher
set "GamePathsLoaded="
for /f "usebackq tokens=1,* delims==" %%a in (`powershell -NoProfile -NonInteractive -Command "$ErrorActionPreference = 'Stop'; try { $properties = [xml](Get-Content -LiteralPath ($env:ROOT + 'Directory.Build.props') -Raw); foreach ($name in 'TerrariaDir', 'TModLoaderDir') { $value = $properties.SelectSingleNode('/Project/PropertyGroup/' + $name).InnerText; Write-Output ($name + '=' + $value) }; 'GamePathsLoaded=1' } catch { [Console]::Error.WriteLine($_.Exception.Message); exit 1 }"`) do if not defined %%a set "%%a=%%b"
if not defined GamePathsLoaded exit /b 1
if not defined TerrariaDir set "TerrariaDir=%ProgramFiles(x86)%\Steam\steamapps\common\Terraria"
if not defined TModLoaderDir set "TModLoaderDir=%ProgramFiles(x86)%\Steam\steamapps\common\tModLoader"
if not exist "%TerrariaDir%\Terraria.exe" if not exist "%TModLoaderDir%\tModLoader.dll" (echo No game found. Set TerrariaDir or TModLoaderDir to your game folder and run again & goto fail)
echo TerraSharp auto-load
echo Terraria folder: "%TerrariaDir%"
@@ -25,7 +25,7 @@ if errorlevel 2 goto uninstall
:install
echo.
if not exist "%TerrariaDir%\Terraria.exe" goto tmodloader
if not exist "%DLL%" (echo "%DLL%" not found, run build.bat first & goto fail)
if not exist "%DLL%" (echo "%DLL%" not found, keep the bin folder beside autoload.bat & goto fail)
echo Terraria:
call :configure Install 1
if errorlevel 1 goto fail
@@ -41,7 +41,7 @@ echo tModLoader: add this to its Steam launch options (Properties ^> General ^>
echo.
powershell -NoProfile -NonInteractive -Command "[Console]::WriteLine(' cmd /d /s /c ' + [char]34 + [char]34 + $env:ROOT + 'autoload.bat' + [char]34 + ' %%command%%' + [char]34)"
echo.
if not exist "%HOOK%" echo (build the tModLoader DLL first: build.bat)
if not exist "%HOOK%" echo ("%HOOK%" not found, keep the bin folder beside autoload.bat)
goto done
:uninstall
@@ -72,7 +72,7 @@ powershell -NoProfile -NonInteractive -Command "$source = [IO.File]::ReadAllText
exit /b %errorlevel%
:launcher
if not exist "%HOOK%" (echo TerraSharp: "%HOOK%" not found, run build.bat first & exit /b 1)
if not exist "%HOOK%" (echo TerraSharp: "%HOOK%" not found, keep the bin folder beside autoload.bat & exit /b 1)
if not defined DOTNET_STARTUP_HOOKS (
set "DOTNET_STARTUP_HOOKS=%HOOK%"
goto launch