title: Setting DestDir from Inno Pascal?
body: <p>I want to install files in different folders, depending on whether the user has selected to install for all users or just the current user.</p>
  
  <p>I have added used CreateInputOptionPage() to create an option page with two radio buttons.</p>
  
  <p>However, my installer is now littered with lots of duplicate lines, like these two:</p>
  
  <pre><code>Source: {#ProjectRootFolder}\License.txt; DestDir: {userdocs}\{#MyAppName}; Check: NOT IsAllUsers
  Source: {#ProjectRootFolder}\License.txt; DestDir: {commondocs}\{#MyAppName}; Check:IsAllUsers
  </code></pre>
  
  <p>Is there a more elegant way to do the above? Can Pascal code, for example, create a variable like #define does so I can use it in place of {userdocs} and {commondocs} above?</p>
  
  <p>Further details:</p>
  
  <p>The IsAllUsers() function above calls this code:</p>
  
  <pre><code>function IsAllUsers: Boolean;
  begin
  #ifdef UPDATE
    Result := AllUsersInRegistryIsTRUE;
  #else
    Result := AllUsersOrCurrentUserPage.Values[1]; // wizard page second radio button
  #endif
  end; 
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>function AllUsersInRegistryIsTRUE: Boolean;  // True if preceding install was to all users' documents 
  var
    AllUsersRegValue: AnsiString;
  begin
    if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\MyApp', 'AllUsers', AllUsersRegValue) then
      Result := (UpperCase(AllUsersRegValue) = 'YES')
    else
      Result := FALSE;
  end; 
  </code></pre>