0

I am trying to set the path in the 'choose install directory' form using INNO setup. Here is my code

procedure CurPageChanged(pageID: Integer);                                                   
var
  sInstallDir: String;  
begin                                                                   

  // Default install dir is the IIS install path
  if (pageID = wpSelectDir) then begin
    sInstallDir := GetIISInstallPath + '\MyFolder';
    Log('GetIISInstallPath: '+ GetIISInstallPath);
    Log('sInstallDir: ' + sInstallDir);
    WizardForm.DirEdit.Text := sInstallDir;    
  end;  
end;

The problem I am having is that 'GetIISInstallPath' returns me 'c:\inetpub\wwwroot and that is what I see in the WizardForm. It seems to not add the MyFolder bit. I printed out the involved variables and they all have the correct value.

sInstallDir shows up as 'C:\inetpub\wwwroot\MyFolder' but it does not show in the text field. It shows (as mentioned) only 'C:\inetpub\wwwroot'.

Please advise.

Thank You

ababeel
  • 435
  • 1
  • 8
  • 25

1 Answers1

2

Your code works fine for me but, can I suggest you to use

[Setup]
...
DefaultDirName={code:GetDefaultDirName}


[code]
...
function GetDefaultDirName(): String;
begin
Result := GetIISInstallPath + '\MyFolder';
end;

Doing this the "GetIISInstallPath + \MyFolder" will be your default directory

KingOfMazes
  • 130
  • 1
  • 12
  • Still does not work. Some background info that I should have added earlier. The GetIISInstallPath reads the registry and gets the value %SYSTEMDRIVE\inetpub\wwwroot which I expand using the code given here http://stackoverflow.com/a/32024923/269185. At every stage when I Log the variables, they all printout with the correct value. The text field is not updated at all properly. I tried using {code..} method as well, but no luck, – ababeel Oct 15 '15 at 04:19