SetReqStrLen: Allow compile w/ 8192 special build only
From NSIS Wiki
Jump to navigationJump to search
Author: Afrow UK (talk, contrib) |
Description
Currently (at time of writing) you can't change NSIS_MAX_STRLEN without re-compiling NSIS (or by downloading a special makensis.exe build from the Special Builds page). This was a problem because some NSIS projects would require the special build and some wouldn't, and sometimes we'd compile a project that required the special build, with the normal MakeNSIS build.
This cool snippet of code will stop scripts that need the 8192 NSIS_MAX_STRLEN special build from compiling.
Save it into your NSIS Include folder, as e.g. SetReqStrLen.nsh...
The Snippet
!macro SetReqStrLen Req_STRLEN !define "Check_${NSIS_MAX_STRLEN}" !ifndef "Check_${Req_STRLEN}" !error "You're not using the ${Req_STRLEN} string length special build! \ ${NSIS_MAX_STRLEN} is no good!" !else !undef "Check_${NSIS_MAX_STRLEN}" !undef "SetReqStrLen" !endif !macroend !define SetReqStrLen "!insertmacro SetReqStrLen"
Then, in your own scripts use...
!include SetReqStrLen.nsh ${SetReqStrLen} 8192
If you want your script to compile only on the normal build, change 8192 to 1024.
I made it for kike_velez in this topic.
-Stu