The reason is simple. People don't know which systems they use and browser detection can not working. Since a lot of games contains data independent of the operating system and maybe independent on the hardware, you/we can create single installer file (shell script), which will detect platform, unpack game data, unpack correct executable, (on Unix) makes file executable and ran unpacked executable, giving file path with data as argument.
Another use case is Java. User could download multiplatform installer. And another use-case is also related to stuff like Java. I created my tool with be bridge of platform in mind, so someone writes program in Java and pack it into special executable file. This executable (script) will extract program written in Java, detect platform, check Java is installed. If Java isn't installed, it will download it for current platform and install. If Java is installed, it only runs extracted program.
But this is forums about game developing.
What about write multiplatform game installer, like mono installer, but it will works both on Windows and GNU/Linux platforms (MacOS in future)?
Below I attached example program. Tomorrow I will produce screencast and share build tool, which I used to build attached script.
- {l Code}: {l Select All Code}
#!/bin/bash
@echo off
echo Ignore above notice. It is hack to run this script both on Windows and GNU/Linux systems.
::() { echo a > /dev/null; }; @echo() { echo a > /dev/null; }; goto() { echo a > /dev/null; }; rem() { echo a > /dev/null; }
goto dos_aliases
shopt -s expand_aliases
alias set='export'
if false ; then
:unquote
set %1=%~2
goto :EOF
:dos_aliases
set fcmd="if \"%1\"==\"param\" goto param"
set scmd="start /B %~dp0\%~n0.bat param"
call :unquote fcmd %fcmd%
call :unquote scmd %scmd%
%fcmd%
%scmd%
sleep 1
exit 0
:param
:: ;fi
set content=IFRoaXMgaXMgdGV4dAo=
goto windows_variables
::; if false ; then
:windows_variables
set wr="cmd.exe /c"
set wd=""
set wscu="dHlwZSAlMSAK"
call :unquote wscu %wscu%
set wscn="super.bat"
call :unquote wscn %wscn%
set wcfe=".bat"
call :unquote wcfe %wcfe%
call :unquote wr %wr%
::; fi
set lr="source"
set ld=""
set lscu="IyEvYmluL2Jhc2gKY2F0ICQxCg=="
set lscn=""
::a () { echo a > /dev/null; }
goto a
alias ':a'='::a'
file=`mktemp -t flatpak-XXXXXX | tr -d '\n'`
echo -n $content | base64 -d > $file
rem we have two files to unpack here
if [ "$lscu" != "" ]; then
file2=`mktemp -t flatpak-XXXXXX | tr -d '\n'`
echo -n $lscu | base64 -d > $file2
$lr $file2 $file
else
chmod +x $file
$lr $file
fi
if false ; then
:a
del %UserProfile%\content
del %UserProfile%\content2
del %UserProfile%\scontent
del %UserProfile%\scontent2
echo -----BEGIN CERTIFICATE----- > %UserProfile%\content
echo %content% >> %UserProfile%\content
echo -----END CERTIFICATE----- >> %UserProfile%\content
certutil -decode %UserProfile%\content %UserProfile%\content2
move %UserProfile%\content2 content2%wcfe%
set fcmd="if \"%wscu%\"==\"\" goto win_one_executable"
call :unquote fcmd %fcmd%
%fcmd%
rem we have two files to unpack here
echo -----BEGIN CERTIFICATE----- > %UserProfile%\scontent
echo %wscu% >> %UserProfile%\scontent
echo -----END CERTIFICATE----- >> %UserProfile%\scontent
certutil -decode %UserProfile%\scontent %UserProfile%\scontent2
move %UserProfile%\scontent2 %wscn%
%wr% %wscn% %UserProfile%\content2%wcfe%
goto next1
:win_one_executable
%wr% %UserProfile%\content2%wcfe%
:next1
:: ; fi