title: How to use Pascal Inno Setup ExpandConstant with a string variable?
body: <p>For an installation program, I need to create folder links.</p>
  
  <p>For this, I create the target folders using the '[Dirs]' sections. No problem.</p>
  
  <p>Then, in '[Code]' section, using function 'CurStepChanged(ssPostInstall)', I read a temporary installed file to obtain a list of folder links to create. Each line of the file contains a target folder path name, and a link path name... Using Inno Setup constants.
  Each value is read and stored in as 'String' variable.</p>
  
  <p>When I pass these string variables to 'ExpandConstant(lLinkTarg)', I get an internal runtime error on any of the constant names.</p>
  
  <p>If I copy paste the string content to a 'ExpandConstant('{#gRepNasSvg}\UT{code:getProjetc}\Docs')' call, then it works...</p>
  
  <p>Any hint about what I do wrong ?</p>
  
  <p>Thanks in advance.
  L.</p>
  
  <pre><code>procedure CurStepChanged(CurStep: TSetupStep);
  var
      lFileName: String;
      lLinkList: TArrayOfString;
      lIndex: Integer;
      lLinkLine: String;
      lLinkName: String;
      lLinkTarg: String;
      lSepPos: Integer;
  
  begin
      // Après l'étape d'installation...
      if CurStep = ssPostInstall then
          begin
              // Si le fichier listant les liens à créer existe...
              lFileName := ExpandConstant('{tmp}') + '\' + ExpandConstant('{#gFicListeLiens}');
              if FileExists(lFileName) then
                  begin
                      // Lecture du contenu du fichier.
                      LoadStringsFromFile(lFileName, lLinkList);
  
                      // Pour chaque ligne lue...
                      for lIndex := 0 to GetArrayLength(lLinkList) - 1 do
                      begin
                          // Lecture de la ligne.
                          lLinkLine := Trim(lLinkList[lIndex]);
  
                          // Si ce n'est pas un commentaire...
                          if (Length(lLinkLine) &gt; 0) and (lLinkLine[1] &lt;&gt; ';') then
                              begin
                                  // Recherche du séparateur.
                                  lSepPos := Pos('&gt;', lLinkLine);
                                  if lSepPos &gt; 0 then
                                      begin
                                          // Get target location.
                                          lLinkTarg := Trim(Copy(lLinkLine, 1, lSepPos - 1));
  MsgBox(lLinkTarg, mbInformation, MB_OK);
  
                                          // NEXT LINE FAILS !
                                          lLinkTarg := ExpandConstant(lLinkTarg) ;
  MsgBox(lLinkTarg, mbInformation, MB_OK);
  
                                          // Get link location.
                                          lLinkName := Trim(Copy(lLinkLine, lSepPos + 1, Length(lLinkLine) - lSepPos));
  MsgBox(lLinkName, mbInformation, MB_OK);
  
                                      end
                              end
                      end
                  end
          end
  end;
  </code></pre>
  
  <p>Some stuff I have forgotten.</p>
  
  <p>Link description variable is of the form '{#gRepNasSvg}\UT{code:getProjetc}\Docs'...</p>