Friday, 27 September 2013

makeimg does not report ERRORLEVEL from pre-/postmakeimg.bat

The platform specific (optional) batch files premakimg.bat and postmakeimg.bat are extremely helpful to cusomize the makeimg buildstep. But what if something went wrong? Unfortunately setting exiting the script with an errorlevel

exit /B 1
doesn't help. makeimg.exe simply doesn't catch those cases. But there is a simple solution to workaround that problem: Accidentally I found out that makeimg.exe reports syntax errors. So, why not abuse that. Simply write the following lines in the error label of your scripts:
@ECHO The following lines 'if(...)' are a hack to make makimg.exe stop further processing (exit /B 1 doesn't work)
if 1==2(
)
exit /B 1
Have fun, Jürgen