SMAPI - Stardew Modding API

SMAPI - Stardew Modding API

971k Downloads

Minor suggestion for improving the "install on Windows.bat" file

LostLogic opened this issue ยท 1 comments

commented

Hello!
By adding pushd %~dp0 before the install command, it allow for the bat file to be run as admin for instance.
It basically pushes the script execution path as the current path for all following commands ensuring that the path to internal/windows-install.exe is correct.
Alternatively, one can just add %~dp0 to the install path, changing it to:
start /WAIT /B "%~dp0\internal\windows-install.exe"
Ensure the path is in quotes to prevent path breaking if it contain spaces.

@echo off
echo %~dp0 | findstr /C:"%TEMP%" 1>nul
if not errorlevel 1 (
   echo Oops! It looks like you're running the installer from inside a zip file. Make sure you unzip the download first.
   pause
) else (
   pushd %~dp0
   start /WAIT /B ./internal/windows-install.exe
)
commented

Done in develop for the upcoming SMAPI 3.10.2. Thanks for the suggestion!