Improves the Windows install script
Verifies if Java exists in the path (and warns the user if it is not present)
Adds a Desktop shortcut
Clarifies some of the final output
@@ -6,14 +6,40 @@ C:
cd %PROGRAMFILES%
if not exist Clava md Clava
cd Clava
-if not exist clava.zip curl specs.fe.up.pt/tools/clava.zip > clava.zip
+
+if not exist clava.zip curl https://specs.fe.up.pt/tools/clava.zip > clava.zip
tar -xvf clava.zip
del clava.zip
+
echo @echo off > clava.cmd
echo java -jar "%%~dp0clava.jar" %%^* >> clava.cmd
+
+if not exist icon.ico curl https://raw.githubusercontent.com/specs-feup/clava/master/install/windows/icon.ico > icon.ico
+set ICO = "%PROGRAMFILES%/Clava/clava.ico"
+set SCRIPT="%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.vbs"
+echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT%
+echo sLinkFile = "%USERPROFILE%\Desktop\Clava.lnk" >> %SCRIPT%
+echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT%
+echo oLink.TargetPath = "%PROGRAMFILES%/Clava/clava.cmd" >> %SCRIPT%
+echo oLink.IconLocation = "%PROGRAMFILES%/Clava/icon.ico" >> %SCRIPT%
+echo oLink.Save >> %SCRIPT%
+cscript /nologo %SCRIPT%
+del %SCRIPT%
+
+where /q java
+if errorlevel 1 (
+ echo:
+ echo Java is missing! You need to have Java on the PATH for Clava to run.
+ exit /B
+) else (
+ echo:
+ echo Java found on the path.
+)
+
echo:
echo Clava successfully installed to %PROGRAMFILES%\Clava
-echo Start Clava by opening clava.cmd. It requires Java to be installed and on the PATH.
+echo:
+echo Start Clava by opening clava.cmd, or by using the Desktop shortcut.
echo You may also want to add Clava's install directory to the PATH if you want to access Clava from anywhere.
echo:
pause
