-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathautorun.cmd
47 lines (40 loc) · 1.05 KB
/
autorun.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
@echo off
setlocal enabledelayedexpansion
:: It will default to searching for love
:: but you can override the default by
:: setting the `LOVE` env var to another name
:: ex:
:: ```
:: set LOVE="C:\Program Files\LOVE\love.exe"
:: ``
:: Check if LOVE environment variable is set
if not "%LOVE%"=="" (
if exist "%LOVE%" (
set LOVE=%LOVE%
goto execute
)
)
:: Search through PATH
for %%I in (love.exe) do set love_path=%%~$PATH:I
if exist "!love_path!" (
set LOVE=!love_path!
goto execute
)
:: Check common install locations
set check_folders="%ProgramFiles%\LOVE\love.exe" "%ProgramFiles(x86)%\LOVE\love.exe" "%APPDATA%\LOVE\love.exe" "%LOCALAPPDATA%\LOVE\love.exe"
for %%I in (%check_folders%) do (
if exist "%%~I" (
set LOVE=%%~I
goto execute
)
)
:: Error if not found
echo Error: love.exe not found in PATH, Program Files, or AppData
echo Install LÖVE or set LOVE environment variable to your executable
exit /b 1
:: make sure to preserve current working directory
:execute
pushd lua
"%LOVE%" .
popd
endlocal