title: My string comparaison is not working with if nsis statement
body: <p>NSIS is driving me crazy, I am not able to do something really straightforward.  Following string comparison with if statement is not working.  Could someone tell me what I am doing wrong?</p>
  
  <pre><code>!ifndef PRODUCT_NAME
      !define PRODUCT_NAME "$%PRODUCT_NAME%"
  !endif
  
  DetailPrint "TEST - ${PRODUCT_NAME}"
  ${If} ${PRODUCT_NAME} == "DEMO_NOT_FOR_RETAIL"
      DetailPrint "DEMO"
      File /r ${LOCAL_DIST_DIR_OUTPUT}\bin\win64
  ${Else}
      DetailPrint "NOT DEMO"
  ${EndIf}
  </code></pre>
  
  <p>Whatever what is the value of ${PRODUCT_NAME}, it enters in the if statement.  PRODUCT_NAME is a environment variable set by my shell script just  before calling my nsis script</p>
  
  <p><strong>EDIT</strong>
  As suggested by Anders, I tried (learnt) to use variables instead of define :</p>
  
  <pre><code>Var /Global PRODUCT_NAME
  StrCpy $PRODUCT_NAME "$%PRODUCT_NAME%"
  
  DetailPrint "TEST - $PRODUCT_NAME"
  ${If} $PRODUCT_NAME == "DEMO_NOT_FOR_RETAIL"
      DetailPrint "DEMO"
      File /r ${LOCAL_DIST_DIR_OUTPUT}\bin\win64
  ${Else}
      DetailPrint "NOT DEMO"
  ${EndIf}
  </code></pre>
  
  <p>Unfortunaly, does not work.  See traces :</p>
  
  <pre><code> Var: "PRODUCT_NAME"
  StrCpy $PRODUCT_NAME "sdk" () ()
  DetailPrint: "TEST - $PRODUCT_NAME"
  !insertmacro: _If
  !insertmacro: _PushLogic
  !insertmacro: _PushScope
  !define: "_Logic"="_LogicLib_Label_53"
  !insertmacro: end of _PushScope
  !insertmacro: _IncreaseCounter
  !define: "_LOGICLIB_COUNTER"="53"
  !undef: "LOGICLIB_COUNTER"
  !define: "LOGICLIB_COUNTER"="54"
  !undef: "_LOGICLIB_COUNTER"
  !insertmacro: end of _IncreaseCounter
  !insertmacro: end of _PushLogic
  !define: "_LogicLib_Label_53If"=""
  !define: "_LogicLib_Label_53Else"="_LogicLib_Label_54"
  !insertmacro: _IncreaseCounter
  !define: "_LOGICLIB_COUNTER"="54"
  !undef: "LOGICLIB_COUNTER"
  !define: "LOGICLIB_COUNTER"="55"
  !undef: "_LOGICLIB_COUNTER"
  !insertmacro: end of _IncreaseCounter
  !define: "_c=true"=""
  !insertmacro: _==
  StrCmp "$PRODUCT_NAME" "DEMO_NOT_FOR_RETAIL" equal=, nonequal=_LogicLib_Label_54
  </code></pre>