105 lines
3.7 KiB
Batchfile
105 lines
3.7 KiB
Batchfile
|
|
@echo off
|
|
REM Relaunch minimized if not already
|
|
if "%minimized%"=="" (
|
|
set minimized=true
|
|
start "" /min cmd /c "%~dpnx0"
|
|
exit /b
|
|
)
|
|
|
|
REM Launch-StudioBridge.bat - Universal launcher for StudioBridge portable
|
|
REM This script works from anywhere, even if the project folder is moved
|
|
|
|
REM Get the directory where this script is located
|
|
set "ROOTDIR=%~dp0"
|
|
|
|
REM Set the path to the portable-dist folder
|
|
set "PORTABLE=%ROOTDIR%portable-dist"
|
|
|
|
REM ---------------------------------------------------------------------------
|
|
REM JAR auto-download (StudioBridge 2.1.2)
|
|
REM ---------------------------------------------------------------------------
|
|
set "JAR_FILE=%PORTABLE%\StudioBridge-2.1.2.jar"
|
|
set "JAR_URL=https://github.com/Rdiger-36/StudioBridge/releases/download/v.2.1.2/StudioBridge-2.1.2.jar"
|
|
|
|
if not exist "%JAR_FILE%" (
|
|
echo [JAR] StudioBridge-2.1.2.jar not found.
|
|
echo [JAR] Downloading StudioBridge 2.1.2...
|
|
echo.
|
|
powershell -NoProfile -Command "Invoke-WebRequest -Uri '%JAR_URL%' -OutFile '%JAR_FILE%'" 2>nul
|
|
if not exist "%JAR_FILE%" (
|
|
echo ERROR: JAR download failed. Please check your internet connection.
|
|
echo You can also manually download StudioBridge-2.1.2.jar from:
|
|
echo https://github.com/Rdiger-36/StudioBridge/releases/tag/v.2.1.2
|
|
echo and place it in: %PORTABLE%
|
|
pause
|
|
exit /b 1
|
|
)
|
|
echo [JAR] StudioBridge 2.1.2 downloaded successfully.
|
|
echo.
|
|
)
|
|
REM ---------------------------------------------------------------------------
|
|
|
|
REM ---------------------------------------------------------------------------
|
|
REM JRE auto-download (Temurin 21 LTS for Windows x64)
|
|
REM ---------------------------------------------------------------------------
|
|
set "JRE_DIR=%PORTABLE%\jre"
|
|
set "JRE_EXE=%JRE_DIR%\bin\java.exe"
|
|
set "JRE_ZIP=%TEMP%\temurin21-jre.zip"
|
|
set "JRE_URL=https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.11%%2B10/OpenJDK21U-jre_x64_windows_hotspot_21.0.11_10.zip"
|
|
set "JRE_FOLDER=jdk-21.0.11+10-jre"
|
|
|
|
if not exist "%JRE_EXE%" (
|
|
echo [JRE] Java 21 runtime not found in portable-dist\jre\
|
|
echo [JRE] Downloading Temurin 21.0.11 LTS ^(~47 MB^)...
|
|
echo.
|
|
|
|
REM Use PowerShell to download the zip
|
|
powershell -NoProfile -Command "Invoke-WebRequest -Uri '%JRE_URL%' -OutFile '%JRE_ZIP%'" 2>nul
|
|
if not exist "%JRE_ZIP%" (
|
|
echo ERROR: Download failed. Please check your internet connection.
|
|
echo You can also manually place a Java 21 JRE at:
|
|
echo %JRE_DIR%
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo [JRE] Extracting...
|
|
|
|
REM Extract zip then move the inner folder to jre\
|
|
powershell -NoProfile -Command ^
|
|
"Expand-Archive -Path '%JRE_ZIP%' -DestinationPath '%TEMP%\temurin21-extract' -Force; " ^
|
|
"Move-Item -Path '%TEMP%\temurin21-extract\%JRE_FOLDER%' -Destination '%JRE_DIR%' -Force; " ^
|
|
"Remove-Item '%TEMP%\temurin21-extract' -Recurse -Force -ErrorAction SilentlyContinue; " ^
|
|
"Remove-Item '%JRE_ZIP%' -Force -ErrorAction SilentlyContinue"
|
|
|
|
if not exist "%JRE_EXE%" (
|
|
echo ERROR: JRE extraction failed. Please manually place a Java 21 JRE at:
|
|
echo %JRE_DIR%
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo [JRE] Java 21 runtime installed successfully.
|
|
echo.
|
|
)
|
|
REM ---------------------------------------------------------------------------
|
|
|
|
REM Check if StudioBridge.bat exists
|
|
if not exist "%PORTABLE%\StudioBridge.bat" (
|
|
echo ERROR: Could not find portable-dist\StudioBridge.bat
|
|
echo Please make sure the portable-dist folder exists in:
|
|
echo %PORTABLE%
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
REM Change to the portable-dist directory
|
|
pushd "%PORTABLE%"
|
|
|
|
REM Launch StudioBridge.bat
|
|
call StudioBridge.bat
|
|
|
|
REM Return to the original directory
|
|
popd
|